github.com/tilt-dev/tilt@v0.36.0/integration/onewatch_exec_test.go (about) 1 //go:build integration 2 // +build integration 3 4 package integration 5 6 import ( 7 "context" 8 "fmt" 9 "testing" 10 "time" 11 12 "github.com/stretchr/testify/assert" 13 ) 14 15 func TestWatchExec(t *testing.T) { 16 f := newK8sFixture(t, "onewatch_exec") 17 18 f.TiltUp("--update-mode=exec") 19 20 fmt.Printf("Wait for pods ready\n") 21 ctx, cancel := context.WithTimeout(f.ctx, time.Minute) 22 defer cancel() 23 oneUpPods := f.WaitForAllPodsReady(ctx, "app=onewatchexec") 24 25 fmt.Printf("Pods ready: %s\n", oneUpPods) 26 fmt.Printf("Wait for server available on 31234\n") 27 ctx, cancel = context.WithTimeout(f.ctx, time.Minute) 28 defer cancel() 29 f.CurlUntil(ctx, "http://localhost:31234", "🍄 One-Up! 🍄") 30 31 fmt.Printf("Replace source.txt contents and wait for change to take effect") 32 f.ReplaceContents("source.txt", "One-Up", "Two-Up") 33 34 ctx, cancel = context.WithTimeout(f.ctx, time.Minute) 35 defer cancel() 36 f.CurlUntil(ctx, "http://localhost:31234", "🍄 Two-Up! 🍄") 37 38 twoUpPods := f.WaitForAllPodsReady(ctx, "app=onewatchexec") 39 fmt.Printf("New pods ready: %s\n", twoUpPods) 40 // Assert that the pods were changed in-place, and not that we 41 // created new pods. 42 assert.Equal(t, oneUpPods, twoUpPods) 43 }