Пример #1
0
func TestGetInputPath(t *testing.T) {
	assert.Equal(t, "", GetInputPath(memfs.Create(), venv.Mock()))
	assert.Equal(t, "aaa", GetInputPath(memfs.Create(), envWith(map[string]string{"TF_STATE": "aaa"})))
	assert.Equal(t, "bbb", GetInputPath(memfs.Create(), envWith(map[string]string{"TI_TFSTATE": "bbb"})))
	assert.Equal(t, "terraform.tfstate", GetInputPath(fsWithFiles([]string{"terraform.tfstate"}), venv.Mock()))
	assert.Equal(t, ".terraform/terraform.tfstate", GetInputPath(fsWithFiles([]string{".terraform/terraform.tfstate"}), venv.Mock()))
}
Пример #2
0
func envWith(env map[string]string) venv.Env {
	e := venv.Mock()

	for k, v := range env {
		e.Setenv(k, v)
	}

	return e
}