github.com/tilt-dev/tilt@v0.36.0/integration/oneup_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 TestOneUp(t *testing.T) {
    16  	f := newK8sFixture(t, "oneup")
    17  	f.SetRestrictedCredentials()
    18  
    19  	f.TiltUp("oneup")
    20  
    21  	// ForwardPort will fail if all the pods are not ready.
    22  	//
    23  	// We can't use the normal Tilt-managed forwards here because
    24  	// Tilt doesn't setup forwards when --watch=false.
    25  	ctx, cancel := context.WithTimeout(f.ctx, time.Minute)
    26  	defer cancel()
    27  	f.WaitForAllPodsReady(ctx, "app=oneup")
    28  
    29  	f.ForwardPort("deployment/oneup", "31234:8000")
    30  
    31  	ctx, cancel = context.WithTimeout(f.ctx, time.Minute)
    32  	defer cancel()
    33  	f.CurlUntil(ctx, "http://localhost:31234", "🍄 One-Up! 🍄")
    34  
    35  	// minimal sanity check that the engine dump works - this really just ensures that there's no egregious
    36  	// serialization issues
    37  	var b bytes.Buffer
    38  	assert.NoErrorf(t, f.tilt.DumpEngine(f.ctx, &b), "Failed to dump engine state, command output:\n%s", b.String())
    39  }