Skip to content

Commit

Permalink
Change file path for restart tests to avoid permission issue (#1389)
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
  • Loading branch information
helsaawy committed May 6, 2022
1 parent 840593a commit d12d411
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/cri-containerd/containerdrestart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func Test_Container_CRI_Restart(t *testing.T) {
// test preserving state after restarting pod
func Test_Container_CRI_Restart_State(t *testing.T) {
testFile := "t.txt"
wcowTestFile := `C:\Users\ContainerUser\t.txt`

client := newTestRuntimeClient(t)
ctx, cancel := context.WithCancel(context.Background())
Expand Down Expand Up @@ -253,8 +254,8 @@ func Test_Container_CRI_Restart_State(t *testing.T) {
Runtime: wcowHypervisorRuntimeHandler,
Image: imageWindowsNanoserver,
Command: []string{"cmd", "/c", "ping -t 127.0.0.1"},
SetStateCommand: []string{"cmd", "/c", "echo - >> " + testFile},
GetStateCommand: []string{"cmd", "/c", "type", testFile},
SetStateCommand: []string{"cmd", "/c", "echo - >> " + wcowTestFile},
GetStateCommand: []string{"cmd", "/c", "type", wcowTestFile},
ExpectedResult: "- \r\n",
},
{
Expand All @@ -263,8 +264,8 @@ func Test_Container_CRI_Restart_State(t *testing.T) {
Runtime: wcowHypervisorRuntimeHandler,
Image: imageWindowsNanoserver,
Command: []string{"cmd", "/c", "ping -t 127.0.0.1"},
SetStateCommand: []string{"cmd", "/c", "echo - >> " + testFile},
GetStateCommand: []string{"cmd", "/c", "type", testFile},
SetStateCommand: []string{"cmd", "/c", "echo - >> " + wcowTestFile},
GetStateCommand: []string{"cmd", "/c", "type", wcowTestFile},
ExpectedResult: "- \r\n",
},
}
Expand Down Expand Up @@ -320,6 +321,7 @@ func Test_Container_CRI_Restart_State(t *testing.T) {
if req.ExitCode != 0 {
t.Fatalf("exec %v failed with exit code %d: %s", startExecRequest.Cmd, req.ExitCode, string(req.Stderr))
}
t.Logf("exec: %s", tt.SetStateCommand)

// check the write worked
startExecRequest = &runtime.ExecSyncRequest{
Expand Down

0 comments on commit d12d411

Please sign in to comment.