Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

ut: fix make test failures #2371

Merged
merged 7 commits into from
Dec 27, 2019
Merged

ut: fix make test failures #2371

merged 7 commits into from
Dec 27, 2019

Conversation

bergwolf
Copy link
Member

@bergwolf bergwolf commented Dec 23, 2019

The PR fixes several make test failures:

  • testing: can't write /tmp/go-build146132196/b001/testlog.txt: close /tmp/go-build146132196/b001/testlog.txt: file already closed

  • mkdir /var/lib/vc/uuid: permission denied

  • clh_test.go:191: cloudHypervisor.cleanupVM() expected error != open /run/vc/vm: permission denied

  • several other permission errors in different packages

@bergwolf
Copy link
Member Author

/test

@codecov
Copy link

codecov bot commented Dec 23, 2019

Codecov Report

Merging #2371 into master will decrease coverage by 0.04%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2371      +/-   ##
==========================================
- Coverage   50.12%   50.07%   -0.05%     
==========================================
  Files         112      112              
  Lines       16171    16171              
==========================================
- Hits         8105     8098       -7     
- Misses       7048     7058      +10     
+ Partials     1018     1015       -3

@bergwolf bergwolf changed the title vc: UT should set VCStorePrefix ut: fix make test failures Dec 25, 2019
bergwolf added a commit to bergwolf/kata-tests that referenced this pull request Dec 25, 2019
Currently anything under virtcontainers are skipped for non-root users.
We should just treat them the same as others instead.

Depends-on: Depends-on: github.com/kata-containers/runtime#2371

Fixes: kata-containers#2197
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
bergwolf added a commit to bergwolf/kata-tests that referenced this pull request Dec 25, 2019
Currently anything under virtcontainers are skipped for non-root users.
We should just treat them the same as others instead.

Fixes: kata-containers#2197
Depends-on: github.com/kata-containers/runtime#2371
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
Otherwise we fail to run it with non-root user with errors like:
`mkdir /var/lib/vc/uuid: permission denied`

Fixes: kata-containers#2370
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
Do not flush it atexit(), where the test report file might be already
closed and it causes go test failure like:

PASS
testing: can't write /tmp/go-build146132196/b001/testlog.txt: close /tmp/go-build146132196/b001/testlog.txt: file already closed
FAIL    github.com/kata-containers/runtime/cli  4.256s

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
Otherwise we fail ut on failures like:

=== RUN   TestCloudHypervisorCleanupVM
--- FAIL: TestCloudHypervisorCleanupVM (0.00s)
    clh_test.go:191: cloudHypervisor.cleanupVM() expected error != open /run/vc/vm: permission denied
    clh_test.go:200: Unexpected error = stat /run/vc/vm/cleanVMID: permission denied
=== RUN   TestClhCreateSandbox
--- PASS: TestClhCreateSandbox (0.00s)
=== RUN   TestClooudHypervisorStartSandbox
time="2019-12-25T00:48:47-08:00" level=error msg="trace called before context set" source=virtcontainers subsystem=cloudHypervisor type=bug
--- FAIL: TestClooudHypervisorStartSandbox (0.00s)
        Error Trace:    clh_test.go:266
        Error:          Received unexpected error:
                        mkdir /run/vc/vm: permission denied

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
Otherwise it fails with permission errors.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
Otherwise it failes with permission errors.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
nsenter needs root privilege to run.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
Otherwise we might end up using the previously created store instead.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
@bergwolf
Copy link
Member Author

/test

@bergwolf
Copy link
Member Author

coverage decrease is confusing as I didn't touch any real code, just fixing UTs.

@lifupan lifupan merged commit 3ea3d32 into kata-containers:master Dec 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants