Changeset View
Changeset View
Standalone View
Standalone View
docker/instructions_test.go
Show All 36 Lines | func TestCopy(t *testing.T) { | ||||
di, err := docker.NewInstruction(i) | di, err := docker.NewInstruction(i) | ||||
if assert.NoError(t, err) { | if assert.NoError(t, err) { | ||||
assert.Equal(t, "COPY [\"foo1\", \"foo2\", \"bar\"]\n", di.Compile()) | assert.Equal(t, "COPY [\"foo1\", \"foo2\", \"bar\"]\n", di.Compile()) | ||||
} | } | ||||
} | } | ||||
func TestCopyAs(t *testing.T) { | func TestCopyAs(t *testing.T) { | ||||
t.Run("with Copy", func(t *testing.T) { | |||||
i := build.CopyAs{123, 124, build.Copy{[]string{"foo1", "foo2"}, "bar"}} | i := build.CopyAs{123, 124, build.Copy{[]string{"foo1", "foo2"}, "bar"}} | ||||
di, err := docker.NewInstruction(i) | di, err := docker.NewInstruction(i) | ||||
if assert.NoError(t, err) { | if assert.NoError(t, err) { | ||||
assert.Equal(t, "COPY --chown=123:124 [\"foo1\", \"foo2\", \"bar\"]\n", di.Compile()) | assert.Equal(t, "COPY --chown=123:124 [\"foo1\", \"foo2\", \"bar\"]\n", di.Compile()) | ||||
} | } | ||||
}) | |||||
t.Run("with CopyFrom", func(t *testing.T) { | |||||
i := build.CopyAs{123, 124, build.CopyFrom{"foo", build.Copy{[]string{"foo1", "foo2"}, "bar"}}} | |||||
di, err := docker.NewInstruction(i) | |||||
if assert.NoError(t, err) { | |||||
assert.Equal(t, "COPY --chown=123:124 --from=foo [\"foo1\", \"foo2\", \"bar\"]\n", di.Compile()) | |||||
} | |||||
}) | |||||
} | } | ||||
func TestCopyFrom(t *testing.T) { | func TestCopyFrom(t *testing.T) { | ||||
i := build.CopyFrom{"foo", build.Copy{[]string{"foo1", "foo2"}, "bar"}} | i := build.CopyFrom{"foo", build.Copy{[]string{"foo1", "foo2"}, "bar"}} | ||||
di, err := docker.NewInstruction(i) | di, err := docker.NewInstruction(i) | ||||
if assert.NoError(t, err) { | if assert.NoError(t, err) { | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 3.0 (CC-BY-SA) unless otherwise noted; code licensed under GNU General Public License (GPL) or other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL