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

     1  //go:build integration
     2  // +build integration
     3  
     4  package integration
     5  
     6  import (
     7  	"bytes"
     8  	"testing"
     9  	"time"
    10  
    11  	"github.com/stretchr/testify/assert"
    12  )
    13  
    14  // Make sure that Tilt crashes if there are two tilts running on the same port.
    15  func TestCrash(t *testing.T) {
    16  	f := newK8sFixture(t, "oneup")
    17  
    18  	f.TiltUp()
    19  	time.Sleep(500 * time.Millisecond)
    20  
    21  	out := bytes.NewBuffer(nil)
    22  	// fixture assigns a random unused port when created, which is used for all Tilt commands, so this
    23  	// will collide with the previous invocation
    24  	res, err := f.tilt.Up(f.ctx, UpCommandUp, out)
    25  	assert.NoError(t, err)
    26  	<-res.Done()
    27  	assert.Contains(t, out.String(), "Tilt cannot start")
    28  	assert.NotContains(t, out.String(), "Usage:")
    29  }