mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 16:57:18 +00:00
ut: fix UT failure due to non-root
We should allow UT to run without root. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
6d81e44670
commit
a0f49a91e4
@ -137,6 +137,10 @@ func TestContainerRemoveDrive(t *testing.T) {
|
||||
}
|
||||
|
||||
func testSetupFakeRootfs(t *testing.T) (testRawFile, loopDev, mntDir string, err error) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -282,6 +282,12 @@ func TestHyperCopyFile(t *testing.T) {
|
||||
func TestHyperCleanupSandbox(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
defaultSharedDirSaved := defaultSharedDir
|
||||
defaultSharedDir, _ = ioutil.TempDir("", "hyper-cleanup")
|
||||
defer func() {
|
||||
defaultSharedDir = defaultSharedDirSaved
|
||||
}()
|
||||
|
||||
s := Sandbox{
|
||||
id: "testFoo",
|
||||
}
|
||||
|
@ -935,6 +935,12 @@ func TestKataCopyFile(t *testing.T) {
|
||||
func TestKataCleanupSandbox(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
kataHostSharedDirSaved := kataHostSharedDir
|
||||
kataHostSharedDir, _ = ioutil.TempDir("", "kata-cleanup")
|
||||
defer func() {
|
||||
kataHostSharedDir = kataHostSharedDirSaved
|
||||
}()
|
||||
|
||||
s := Sandbox{
|
||||
id: "testFoo",
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user