Adapt TestDevSyncAPITrigger to improved test protocol
@@ -106,9 +106,8 @@ func TestDevSyncAPITrigger(t *testing.T) {
k8sclient.WaitForPodsReady("test-file-sync")
- Run(t, "testdata/file-sync", "mkdir", "-p", "test")
- Run(t, "testdata/file-sync", "touch", "test/foobar")
- defer Run(t, "testdata/file-sync", "rm", "-rf", "test")
+ ioutil.WriteFile("testdata/file-sync/foo", []byte("foo"), 0644)
+ defer func() { os.Truncate("testdata/file-sync/foo", 0) }()
client.Execute(context.Background(), &proto.UserIntentRequest{
Intent: &proto.Intent{
@@ -117,8 +116,8 @@ func TestDevSyncAPITrigger(t *testing.T) {
})
err := wait.PollImmediate(time.Millisecond*500, 1*time.Minute, func() (bool, error) {
- _, err := exec.Command("kubectl", "exec", "test-file-sync", "-n", ns.Name, "--", "ls", "/test").Output()
- return err == nil, nil
+ out, _ := exec.Command("kubectl", "exec", "test-file-sync", "-n", ns.Name, "--", "cat", "foo").Output()
+ return string(out) == "foo", nil
})
testutil.CheckError(t, false, err)
}
