diff --git a/integration/sync_test.go b/integration/sync_test.go index 5df09960c05..b0df00d122a 100644 --- a/integration/sync_test.go +++ b/integration/sync_test.go @@ -27,30 +27,48 @@ import ( ) func TestDevSync(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } - if ShouldRunGCPOnlyTests() { - t.Skip("skipping test that is not gcp only") + var tests = []struct { + description string + trigger string + }{ + { + description: "sync with polling trigger", + trigger: "polling", + }, + { + description: "sync with notify trigger", + trigger: "notify", + }, } + for _, test := range tests { + t.Run(test.description, func(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } + if ShouldRunGCPOnlyTests() { + t.Skip("skipping test that is not gcp only") + } - ns, client, deleteNs := SetupNamespace(t) - defer deleteNs() + // Run skaffold build first to fail quickly on a build failure + skaffold.Build().InDir("testdata/file-sync").RunOrFail(t) - skaffold.Build().InDir("testdata/file-sync").InNs(ns.Name).RunOrFail(t) + ns, client, deleteNs := SetupNamespace(t) + defer deleteNs() - stop := skaffold.Dev().InDir("testdata/file-sync").InNs(ns.Name).RunBackground(t) - defer stop() + stop := skaffold.Dev("--trigger", test.trigger).InDir("testdata/file-sync").InNs(ns.Name).RunBackground(t) + defer stop() - client.WaitForPodsReady("test-file-sync") + client.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") + 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") - 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 - }) - testutil.CheckError(t, false, err) + 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 + }) + testutil.CheckError(t, false, err) + }) + } }