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

     1  //go:build integration
     2  // +build integration
     3  
     4  package integration
     5  
     6  import (
     7  	"context"
     8  	"strings"
     9  	"testing"
    10  	"time"
    11  )
    12  
    13  func TestOneDockerCompose(t *testing.T) {
    14  	// Make sure a broken kubeconfig has no effect on docker compose.
    15  	t.Setenv("KUBECONFIG", "/path/does/not/exist/kubeconfig")
    16  
    17  	f := newDCFixture(t, "onedc")
    18  	f.dockerKillAll("tilt")
    19  	f.TiltUp()
    20  
    21  	ctx, cancel := context.WithTimeout(f.ctx, time.Minute)
    22  	defer cancel()
    23  
    24  	f.WaitUntil(ctx, "onedc up", func() (string, error) {
    25  		name, err := f.dockerCmdOutput([]string{
    26  			"ps", "-f", "name=onedc", "--format", "{{.Image}}",
    27  		})
    28  		// docker-compose-v1 uses underscores in the image name
    29  		// docker compose v2 uses hyphens
    30  		name = strings.Replace(name, "_", "-", -1)
    31  		return name, err
    32  	}, "onedc-web")
    33  
    34  	f.CurlUntil(ctx, "onedc-web", "localhost:8000", "🍄 One-Up! 🍄")
    35  
    36  	f.ReplaceContents("index.html", "One-Up", "Two-Up")
    37  
    38  	ctx, cancel = context.WithTimeout(f.ctx, time.Minute)
    39  	defer cancel()
    40  	f.CurlUntil(ctx, "onedc-web", "localhost:8000", "🍄 Two-Up! 🍄")
    41  }