diff options
author | Tyler Cipriani <tcipriani@wikimedia.org> | 2018-11-16 16:42:41 -0700 |
---|---|---|
committer | Tyler Cipriani <tcipriani@wikimedia.org> | 2018-11-16 16:43:46 -0700 |
commit | 236d8df84f9f248f58e358448898529d7b81dfc0 (patch) | |
tree | 410ebddca19a326efbef79357651c9d7e3be7b3f | |
parent | 256a9d093425feaecd44f14faadafc2db844774d (diff) | |
download | blubber-236d8df84f9f248f58e358448898529d7b81dfc0.tar.gz |
Fix entrypoint merge behavior
Ensure that the CommonConfig being merged can override the Entrypoint.
Change-Id: Icff4876e632d0bd590d63e72dccb4d67c8d1a435
-rw-r--r-- | config/common.go | 2 | ||||
-rw-r--r-- | config/common_test.go | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/config/common.go b/config/common.go index 32311b8..90c9c5b 100644 --- a/config/common.go +++ b/config/common.go @@ -32,7 +32,7 @@ func (cc *CommonConfig) Merge(cc2 CommonConfig) { cc.Lives.Merge(cc2.Lives) cc.Runs.Merge(cc2.Runs) - if len(cc.EntryPoint) < 1 { + if cc2.EntryPoint != nil { cc.EntryPoint = cc2.EntryPoint } } diff --git a/config/common_test.go b/config/common_test.go index ba9333e..d22bcff 100644 --- a/config/common_test.go +++ b/config/common_test.go @@ -27,6 +27,15 @@ func TestCommonConfigYAML(t *testing.T) { assert.Equal(t, []string{"/bin/foo"}, variant.EntryPoint) } +// Ensure that entrypoints inherit correctly +// +func TestEntryPointMerge(t *testing.T) { + foo := config.CommonConfig{EntryPoint: []string{"/bin/foo"}} + bar := config.CommonConfig{EntryPoint: []string{"/bin/bar"}} + foo.Merge(bar) + assert.Equal(t, []string{"/bin/bar"}, foo.EntryPoint) +} + func TestCommonConfigValidation(t *testing.T) { t.Run("base", func(t *testing.T) { t.Run("ok", func(t *testing.T) { |