diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-12-05 15:11:40 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-12-05 15:11:40 -0500 |
commit | 60bfa305a88c686c91ebc0f8f98ac14405ae10cf (patch) | |
tree | b83e8a8c2decb9fc831d818a6d10824115251b9e /pkg/util/utils_test.go | |
parent | c4fbd2fc9489b318298ada61e4f98d0097bc0b0d (diff) | |
download | podman-60bfa305a88c686c91ebc0f8f98ac14405ae10cf.tar.gz podman-60bfa305a88c686c91ebc0f8f98ac14405ae10cf.tar.bz2 podman-60bfa305a88c686c91ebc0f8f98ac14405ae10cf.zip |
Add ONBUILD support to --change
Return types had to change a bit for this, but since we can wrap
the old v1.ImageConfig, changes are overall not particularly bad.
At present, I believe this only works with commit, not import.
This matches how things were before we changed to the new parsing
so I think this is fine.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/util/utils_test.go')
-rw-r--r-- | pkg/util/utils_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/util/utils_test.go b/pkg/util/utils_test.go index e60c644fd..f4b03599d 100644 --- a/pkg/util/utils_test.go +++ b/pkg/util/utils_test.go @@ -238,6 +238,22 @@ func TestGetImageConfigStopSignal(t *testing.T) { assert.NotNil(t, err) } +func TestGetImageConfigOnBuild(t *testing.T) { + onBuildOne, err := GetImageConfig([]string{"ONBUILD ADD /testdir1"}) + require.Nil(t, err) + require.Equal(t, 1, len(onBuildOne.OnBuild)) + assert.Equal(t, onBuildOne.OnBuild[0], "ADD /testdir1") + + onBuildTwo, err := GetImageConfig([]string{"ONBUILD ADD /testdir1", "ONBUILD ADD /testdir2"}) + require.Nil(t, err) + require.Equal(t, 2, len(onBuildTwo.OnBuild)) + assert.Equal(t, onBuildTwo.OnBuild[0], "ADD /testdir1") + assert.Equal(t, onBuildTwo.OnBuild[1], "ADD /testdir2") + + _, err = GetImageConfig([]string{"ONBUILD "}) + assert.NotNil(t, err) +} + func TestGetImageConfigMisc(t *testing.T) { _, err := GetImageConfig([]string{""}) assert.NotNil(t, err) |