From 72425aebfcec929fc7f2f0c5d706a628a1affd72 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 11 Jun 2019 00:01:27 -0500 Subject: [PATCH] fix: persist original file path when using bases (#672) * fix: persist original file path when using bases Prior to this change, the resulting lock file was called `.lock`, instead of `.lock`. This change ensures the final, merged state has the correct `.FilePath`. * test: Assert proper FilePath in layered HelmState --- pkg/app/app_test.go | 4 ++++ pkg/state/create.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/pkg/app/app_test.go b/pkg/app/app_test.go index e2eff266..399b151d 100644 --- a/pkg/app/app_test.go +++ b/pkg/app/app_test.go @@ -1127,6 +1127,10 @@ helmDefaults: if st.Releases[1].Values[0] != "{{`{{.Release.Name}}`}}/values.yaml" { t.Errorf("unexpected releases[0].missingFileHandler: expected={{`{{.Release.Name}}`}}/values.yaml, got=%s", st.Releases[1].Values[0]) } + + if st.FilePath != yamlFile { + t.Errorf("unexpected filePath: expected=%s, got=%s", yamlFile, st.FilePath) + } } func TestLoadDesiredStateFromYaml_MultiPartTemplate(t *testing.T) { diff --git a/pkg/state/create.go b/pkg/state/create.go index 7c3acf3d..6b599564 100644 --- a/pkg/state/create.go +++ b/pkg/state/create.go @@ -148,6 +148,8 @@ func (c *StateCreator) ParseAndLoad(content []byte, baseDir, file string, envNam return nil, err } + state.FilePath = file + return state, nil }