test: add test to verify presence of 'directory' property in YAML
Signed-off-by: Kevin Biebuyck <kbiebuyck@develop-it.net>
This commit is contained in:
parent
87d659b657
commit
b765d13647
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
|
|
@ -4577,3 +4578,22 @@ func TestPrepareSyncReleases_ValueControlReleaseOverride(t *testing.T) {
|
|||
require.Equal(t, tt.flags, r.flags, "Wrong value control flag for release %s", r.release.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHelmState_DirectoryProperty(t *testing.T) {
|
||||
baseDir := "/abs/path/to"
|
||||
filePath := "helmfile.yaml"
|
||||
state := &HelmState{
|
||||
basePath: baseDir,
|
||||
FilePath: filePath,
|
||||
Directory: baseDir,
|
||||
}
|
||||
|
||||
yamlOut, err := state.ToYaml()
|
||||
if err != nil {
|
||||
t.Fatalf("ToYaml failed: %v", err)
|
||||
}
|
||||
|
||||
if !strings.Contains(yamlOut, "directory: "+baseDir) {
|
||||
t.Errorf("YAML output does not contain expected directory property. Got:\n%s", yamlOut)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue