-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds `values` to state files as proposed in #640. ```yaml values: - key1: val1 - defaults.yaml environments: default: - values: - environments/default.yaml production: - values: - environments/production.yaml ``` `{{ .Valuese.key1 }}` evaluates to `val1` if and only if it is not overrode via the production or the default env, or command-line args. Resolves #640
- Loading branch information
Showing
11 changed files
with
329 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package maputil | ||
|
||
import "testing" | ||
|
||
func TestMapUtil_StrKeys(t *testing.T) { | ||
m := map[string]interface{}{ | ||
"a": []interface{}{ | ||
map[string]interface{}{ | ||
"b": []interface{}{ | ||
map[string]interface{}{ | ||
"c": "C", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
r, err := CastKeysToStrings(m) | ||
if err != nil { | ||
t.Fatalf("unexpected error: %v", err) | ||
} | ||
|
||
a := r["a"].([]interface{}) | ||
a0 := a[0].(map[string]interface{}) | ||
b := a0["b"].([]interface{}) | ||
b0 := b[0].(map[string]interface{}) | ||
c := b0["c"] | ||
|
||
if c != "C" { | ||
t.Errorf("unexpected c: expected=C, got=%s", c) | ||
} | ||
} | ||
|
||
func TestMapUtil_IFKeys(t *testing.T) { | ||
m := map[interface{}]interface{}{ | ||
"a": []interface{}{ | ||
map[interface{}]interface{}{ | ||
"b": []interface{}{ | ||
map[interface{}]interface{}{ | ||
"c": "C", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
r, err := CastKeysToStrings(m) | ||
if err != nil { | ||
t.Fatalf("unexpected error: %v", err) | ||
} | ||
|
||
a := r["a"].([]interface{}) | ||
a0 := a[0].(map[string]interface{}) | ||
b := a0["b"].([]interface{}) | ||
b0 := b[0].(map[string]interface{}) | ||
c := b0["c"] | ||
|
||
if c != "C" { | ||
t.Errorf("unexpected c: expected=C, got=%s", c) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.