teemtee / tmt

Test Management Tool
MIT License
82 stars 123 forks source link

Running a single test should not copy contents of all tests into plan in /var/tmp #1183

Open pemensik opened 2 years ago

pemensik commented 2 years ago

I used command: tmt run -avvv --skip finish plan --default execute --how tmt --interactive test --name . provision --how minute --image rhel9 login.

In my current directory is almost nothing

du -sh .
28K .
du -sh ../..
278M    ../..
du -sh /var/tmp/tmt/run-001/
1,1G    /var/tmp/tmt/run-001/

This is not acceptable. 1minutetip command might be too simplistic, but this is far from a replacement for it.

pemensik commented 2 years ago

Bugzilla report: https://bugzilla.redhat.com/show_bug.cgi?id=2086756

lukaszachy commented 2 years ago

Is any of your parent directories git or fmf root? Currently tmt copies while parent git repo it can traverse from current working directory. We have opened issue to copy only fmf root by default #1016

Easiest for your use case is run tmt command in cwd which doesn't have parent git repo or fmf root. Or make one in cwd.

pemensik commented 2 years ago

Of course I were in git repository and of course it has fmf metadata in its root. Those are internal RH tests of rpms/dnsmasq. I were in directory of the first test listed.

$ fmf ls
/Sanity/Basic-dns-resolver-test
/Sanity/bz1375569-added-dhcp_release6-binary
/Sanity/bz850944-service-dnsmasq-restart-or-dnsmasq-package
/Sanity/bz991473-service-dnsmasq-status-incorrectly-identifies
/Sanity/dhcp-smoke-test
/plans/beakerlib/tier1

$ du -sh Sanity/Basic-dns-resolver-test Sanity/bz1375569-added-dhcp_release6-binary Sanity/bz850944-service-dnsmasq-restart-or-dnsmasq-package Sanity/bz991473-service-dnsmasq-status-incorrectly-identifies Sanity/dhcp-smoke-test plans
32K Sanity/Basic-dns-resolver-test
20K Sanity/bz1375569-added-dhcp_release6-binary
20K Sanity/bz850944-service-dnsmasq-restart-or-dnsmasq-package
28K Sanity/bz991473-service-dnsmasq-status-incorrectly-identifies
24K Sanity/dhcp-smoke-test
8,0K    plans

Now, making a copy of my test is the exact opposite of what I would like.

lukaszachy commented 2 years ago

Well, now this is strange. /me tries to reproduce

pemensik commented 2 years ago

I had a core dump in directory ../../Regression/domain-query-the-last-known-server, which is not even listed by fmf. 267M ../../Regression/domain-query-the-last-known-server

pemensik commented 2 years ago

But of course is part of git repository.

pemensik commented 2 years ago

the test directory. core files are not part of neither fmf or git repo.

Once copied everything under plans/default/tree, once under plans/default/discover. It even doubles the size as a result.

pellecchialuigi commented 2 years ago

I'm working on a kernel component tests that are part of a huge git repository and I'm facing the same side effect. I'm connecting to the guest machine via ssh. One of the biggest folder is .git and anytime I'm running a single test all the repository is pushed to the guest wasting a lot of time and resources.

fmf and git root is /root/anywhere/kernel/

my test are in /root//kernel/X/Y/testname

If I execute the test form any location nested into /root/anywhere/kernel/ the whole repository is copied. I'm not able to run the test from a location outside the root one because tmt is not able to discover the test I want to run. For example from /root/anywhere/. Probably pushing only the test-related folders is a solution for the .git also. In some cases a test can require libraries from a folder other than the test folder.

juk commented 2 years ago

Voting for this one to be added. My team has to run tests from three huge repos in a single test plan. It takes significant amount of time for TMT to copy over everything.

thrix commented 2 years ago

@lukaszachy proposed for next release. What are our next steps in this long term problem? I lost a bit track of the conversation ...

pellecchialuigi commented 2 years ago

I just want to highlight that I am seeing a lot of tests that use relative path for source / import of other files instead of using import as library from fmf file. I think this is a scenario that we have to manage too. Here an example:

. ../../include/include.sh
lukaszachy commented 2 years ago

@thrix Next steps? Find an owner, propose solution, get it accepted as the right thing to do and finally do a PR.

As @pellecchialuigi pointed this could break relative imports so probably have this as opt-in (I think 'test' should have a way how to limit / select files it needs)

psss commented 1 year ago

The file require functionality proposed in #1852 should allow selecting which files should be synced to the guest. @pemensik, will it cover your use case?

pemensik commented 1 year ago

yes, I think that should help in my case.