github.com/tilt-dev/tilt@v0.36.0/integration/namespaceflag_test.go (about) 1 //go:build integration 2 // +build integration 3 4 package integration 5 6 import ( 7 "bytes" 8 "context" 9 "testing" 10 "time" 11 12 "github.com/stretchr/testify/assert" 13 ) 14 15 func TestNamespaceFlag(t *testing.T) { 16 f := newK8sFixture(t, "namespaceflag") 17 f.SetRestrictedCredentials() 18 19 // Specify the namespace in the Tilt Up invocation, 20 // but don't put in in the YAML file. 21 f.TiltUp("namespaceflag", "--namespace=tilt-integration") 22 23 // ForwardPort will fail if all the pods are not ready. 24 // 25 // We can't use the normal Tilt-managed forwards here because 26 // Tilt doesn't setup forwards when --watch=false. 27 ctx, cancel := context.WithTimeout(f.ctx, time.Minute) 28 defer cancel() 29 f.WaitForAllPodsReady(ctx, "app=namespaceflag") 30 31 f.ForwardPort("deployment/namespaceflag", "31234:8000") 32 33 ctx, cancel = context.WithTimeout(f.ctx, time.Minute) 34 defer cancel() 35 f.CurlUntil(ctx, "http://localhost:31234", "🍄 Namespace flag! 🍄") 36 37 // minimal sanity check that the engine dump works - this really just ensures that there's no egregious 38 // serialization issues 39 var b bytes.Buffer 40 assert.NoErrorf(t, f.tilt.DumpEngine(f.ctx, &b), "Failed to dump engine state, command output:\n%s", b.String()) 41 }