github.com/tilt-dev/tilt@v0.36.0/integration/idempotent_test.go (about) 1 //go:build integration 2 // +build integration 3 4 package integration 5 6 import ( 7 "context" 8 "testing" 9 "time" 10 11 "github.com/stretchr/testify/assert" 12 ) 13 14 // Assert that if we 'tilt up' in the same repo twice, 15 // it attaches to the existing pods without redeploying 16 func TestIdempotent(t *testing.T) { 17 f := newK8sFixture(t, "idempotent") 18 19 f.TiltCI("idempotent") 20 21 ctx, cancel := context.WithTimeout(f.ctx, time.Minute) 22 defer cancel() 23 firstPods := f.WaitForAllPodsReady(ctx, "app=idempotent") 24 25 // Run it again, this time with a watch() 26 f.TiltUp() 27 28 // Wait until the port-forwarder sets up 29 ctx, cancel = context.WithTimeout(f.ctx, time.Minute) 30 defer cancel() 31 f.CurlUntil(ctx, "http://localhost:31234", "Idempotent One-Up!") 32 33 ctx, cancel = context.WithTimeout(f.ctx, time.Minute) 34 defer cancel() 35 secondPods := f.WaitForAllPodsReady(ctx, "app=idempotent") 36 37 assert.Equal(t, firstPods, secondPods) 38 }