mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 23:45:06 +02:00
fix env value lost in environment values (#605)
* fix env value lost in environment values Signed-off-by: yxxhero <aiopsclub@163.com> * add more test Signed-off-by: yxxhero <aiopsclub@163.com> Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -15,6 +15,15 @@ type Environment struct {
|
||||
|
||||
var EmptyEnvironment Environment
|
||||
|
||||
// New return Environment with default name and values
|
||||
func New(name string) *Environment {
|
||||
return &Environment{
|
||||
Name: name,
|
||||
Values: map[string]interface{}{},
|
||||
Defaults: map[string]interface{}{},
|
||||
}
|
||||
}
|
||||
|
||||
func (e Environment) DeepCopy() Environment {
|
||||
valuesBytes, err := yaml.Marshal(e.Values)
|
||||
if err != nil {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// See https://github.com/roboll/helmfile/issues/1150
|
||||
@@ -97,3 +98,10 @@ func TestMerge_OverwriteWithNilValue_Issue1154(t *testing.T) {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
envName := "test"
|
||||
env := New(envName)
|
||||
|
||||
require.Equal(t, envName, env.Name, "environment name should be %s, but got %s", envName, env.Name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user