github.com/tilt-dev/tilt@v0.36.0/internal/localexec/localexec_test.go (about) 1 package localexec 2 3 import ( 4 "bytes" 5 "os/exec" 6 "testing" 7 8 "github.com/stretchr/testify/assert" 9 10 "github.com/tilt-dev/tilt/pkg/logger" 11 "github.com/tilt-dev/tilt/pkg/model" 12 ) 13 14 func TestDefaultEnv(t *testing.T) { 15 localKubeconfigPathOnce := KubeconfigPathOnce(func() string { 16 return "/path/to/kubeconfig" 17 }) 18 env := DefaultEnv(8000, "tilt.local", localKubeconfigPathOnce) 19 env.osEnviron = func() []string { return nil } 20 l := logger.NewTestLogger(bytes.NewBuffer(nil)) 21 cmd := &exec.Cmd{} 22 cmdModel := model.Cmd{Argv: []string{"x"}, Env: []string{"x=y"}} 23 env.populateExecCmd(cmd, cmdModel, l) 24 assert.Equal(t, cmd.Env, []string{ 25 "KUBECONFIG=/path/to/kubeconfig", 26 "LINES=24", 27 "COLUMNS=80", 28 "PYTHONUNBUFFERED=1", 29 "TILT_PORT=8000", 30 "TILT_HOST=tilt.local", 31 "TILT_DISABLE_ANALYTICS=1", 32 "x=y", 33 }) 34 }