Skip to content

Commit

Permalink
tiltfile: by default, local servers can start in parallel (#5255)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicks committed Dec 7, 2021
1 parent 37b9138 commit 0d16988
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/tiltfile/tiltfile_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ func (s *tiltfileState) translateLocal() ([]model.Manifest, error) {
lt := model.NewLocalTarget(model.TargetName(r.name), r.updateCmd, r.serveCmd, r.deps).
WithRepos(reposForPaths(paths)).
WithIgnores(ignores).
WithAllowParallel(r.allowParallel).
WithAllowParallel(r.allowParallel || r.updateCmd.Empty()).
WithLinks(r.links).
WithTags(r.tags).
WithIsTest(r.isTest).
Expand Down
7 changes: 7 additions & 0 deletions internal/tiltfile/tiltfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4932,13 +4932,20 @@ func TestLocalResourceAllowParallel(t *testing.T) {
f.file("Tiltfile", `
local_resource("a", ["echo", "hi"], allow_parallel=True)
local_resource("b", ["echo", "hi"])
local_resource("c", serve_cmd=["echo", "hi"])
`)

f.load()
a := f.assertNextManifest("a")
assert.True(t, a.LocalTarget().AllowParallel)
b := f.assertNextManifest("b")
assert.False(t, b.LocalTarget().AllowParallel)

// local_resource serve_cmd is currently modeled as a no-op local cmd that
// triggers a server restart. It's always OK for those no-op local cmds to
// run in parallel.
c := f.assertNextManifest("c")
assert.True(t, c.LocalTarget().AllowParallel)
}

func TestLocalResourceInvalidName(t *testing.T) {
Expand Down

0 comments on commit 0d16988

Please sign in to comment.