github.com/tilt-dev/tilt@v0.36.0/integration/job_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/require"
    12  )
    13  
    14  // Replacing a job often exercises very different codepaths
    15  // than a deployment (because it is immutable)
    16  func TestJob(t *testing.T) {
    17  	f := newK8sFixture(t, "job")
    18  	f.SetRestrictedCredentials()
    19  
    20  	f.TiltUp()
    21  
    22  	ctx, cancel := context.WithTimeout(f.ctx, time.Minute)
    23  	defer cancel()
    24  	f.CurlUntil(ctx, "http://localhost:31234/message.txt", "🍄 One-Up! 🍄")
    25  
    26  	f.ReplaceContents("message.txt", "One-Up", "Two-Up")
    27  
    28  	ctx, cancel = context.WithTimeout(f.ctx, time.Minute)
    29  	defer cancel()
    30  	f.CurlUntil(ctx, "http://localhost:31234/message.txt", "🍄 Two-Up! 🍄")
    31  
    32  	target := f.TargetStatus("foo:update")
    33  	require.NotNil(t, target.State.Waiting)
    34  	require.Equal(t, "waiting-for-dep", target.State.Waiting.WaitReason)
    35  }