From 66fc5626675d1ea07d9dde565c2d68dab2bc07f3 Mon Sep 17 00:00:00 2001 From: Kostiantyn Kalynovskyi Date: Wed, 15 Jul 2020 18:02:47 -0500 Subject: [PATCH] Fix metadata loading by config module In this fix, we make sure that targetPath is taken into the account when forming path to metadata file Change-Id: Ie94c3508161b8c3b9254db08f4bf809348ff54f0 Relates-To: #295 Closes: #295 --- pkg/config/config.go | 2 +- pkg/config/config_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 807336f29..85d79cf3a 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1088,7 +1088,7 @@ func (c *Config) CurrentContextManifestMetadata() (*Metadata, error) { return nil, err } meta := &Metadata{} - err = util.ReadYAMLFile(manifest.MetadataPath, meta) + err = util.ReadYAMLFile(filepath.Join(manifest.TargetPath, manifest.MetadataPath), meta) if err != nil { return nil, err } diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index fbd251958..ce1e4fa58 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -594,7 +594,7 @@ func TestCurrentContextManifestMetadata(t *testing.T) { }{ { name: "default metadata", - metaPath: "testdata/metadata.yaml", + metaPath: "metadata.yaml", expectErr: false, currentContext: "testContext", meta: &config.Metadata{ @@ -630,7 +630,7 @@ func TestCurrentContextManifestMetadata(t *testing.T) { } manifest := &config.Manifest{ MetadataPath: tt.metaPath, - TargetPath: ".", + TargetPath: "testdata", } conf.Manifests = map[string]*config.Manifest{ "testManifest": manifest,