Skip to content

Commit

Permalink
tiltfile: feedback from code review
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Sieger <nick@nicksieger.com>
  • Loading branch information
nicksieger committed Oct 21, 2022
1 parent 8b546d0 commit 6c8cb12
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
42 changes: 21 additions & 21 deletions internal/tiltfile/tiltfile_docker_compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package tiltfile
import (
"fmt"
"path/filepath"
"strconv"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -442,28 +443,27 @@ k8s_yaml('bar.yaml')`
assert.Equal(t, 2, len(f.loadResult.Manifests))
}

func TestDockerComposeAndK8sNameConflict(t *testing.T) {
f := newFixture(t)

f.setupFooAndBar()
f.file("docker-compose.yml", simpleConfig)
tf := `docker_compose('docker-compose.yml')
k8s_yaml('foo.yaml')`
f.file("Tiltfile", tf)

f.loadErrString(`dc_resource named "foo" already exists`)
}

func TestDockerComposeAndLocalNameConflict(t *testing.T) {
f := newFixture(t)

f.setupFooAndBar()
f.file("docker-compose.yml", simpleConfig)
tf := `docker_compose('docker-compose.yml')
local_resource('foo', 'echo hello')`
f.file("Tiltfile", tf)
func TestResourceConflictCombinations(t *testing.T) {
tt := [][2]string{
{`docker_compose('docker-compose.yml')
k8s_yaml('foo.yaml')`, `dc_resource named "foo" already exists`},
{`k8s_yaml('foo.yaml')
docker_compose('docker-compose.yml')`, `dc_resource named "foo" already exists`},
{`docker_compose('docker-compose.yml')
local_resource('foo', 'echo hello')`, `dc_resource named "foo" already exists`},
{`local_resource('foo', 'echo hello')
docker_compose('docker-compose.yml')`, `local_resource named "foo" already exists`},
}

f.loadErrString(`dc_resource named "foo" already exists`)
for i, tc := range tt {
t.Run(strconv.Itoa(i), func(t *testing.T) {
f := newFixture(t)
f.setupFooAndBar()
f.file("docker-compose.yml", simpleConfig)
f.file("Tiltfile", tc[0])
f.loadErrString(tc[1])
})
}
}

func TestDockerComposeResourceCreationFromAbsPath(t *testing.T) {
Expand Down
3 changes: 0 additions & 3 deletions internal/tiltfile/tiltfile_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,6 @@ func (s *tiltfileState) assembleDC() error {
return err
}
}
// TODO(maia): throw warning if
// a. there is an img ref from config, and img ref from user doesn't match
// b. there is no img ref from config, and img ref from user is not of form .*_<svc_name>
}
}
return nil
Expand Down

0 comments on commit 6c8cb12

Please sign in to comment.