github.com/tilt-dev/tilt@v0.36.0/integration/job_reattach_test.go (about)

     1  //go:build integration
     2  // +build integration
     3  
     4  package integration
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/require"
    10  	v1 "k8s.io/api/core/v1"
    11  )
    12  
    13  func TestJobReattach(t *testing.T) {
    14  	f := newK8sFixture(t, "job_reattach")
    15  	f.SetRestrictedCredentials()
    16  
    17  	f.TiltCI()
    18  
    19  	_, _, podNames := f.AllPodsInPhase(f.ctx, "app=job-reattach-db-init", v1.PodSucceeded)
    20  	require.Equal(t, 1, len(podNames))
    21  
    22  	f.runCommandSilently("kubectl", "delete", "-n", "tilt-integration", "pod", podNames[0])
    23  
    24  	// Make sure 'ci' still succeeds, but we don't restart the Job pod.
    25  	f.TiltCI()
    26  
    27  	_, _, podNames = f.AllPodsInPhase(f.ctx, "app=job-reattach-db-init", v1.PodSucceeded)
    28  	require.Equal(t, 0, len(podNames))
    29  }