1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: remove isCpCannotCopyReadOnly utility

This utility was just string-matching error output, and no longer had a
direct connection with ErrContainerRootfsReadonly / ErrVolumeReadonly.
Moving it inline better shows what it's actually checking for.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-09-26 21:02:35 +02:00
parent 3564d03b0f
commit e31e9180cd
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 2 additions and 9 deletions

View file

@ -411,9 +411,7 @@ func (s *DockerCLICpSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
dstPath := containerCpPath(containerID, "/root/shouldNotExist")
err := runDockerCp(c, srcPath, dstPath)
assert.ErrorContains(c, err, "")
assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrContainerRootfsReadonly error, but got %T: %s", err, err)
assert.ErrorContains(c, err, "marked read-only")
assert.NilError(c, containerStartOutputEquals(c, containerID, ""), "dstPath should not have existed")
}
@ -436,8 +434,7 @@ func (s *DockerCLICpSuite) TestCpToErrReadOnlyVolume(c *testing.T) {
dstPath := containerCpPath(containerID, "/vol_ro/shouldNotExist")
err := runDockerCp(c, srcPath, dstPath)
assert.ErrorContains(c, err, "")
assert.ErrorContains(c, err, "marked read-only")
assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrVolumeReadonly error, but got %T: %s", err, err)
assert.NilError(c, containerStartOutputEquals(c, containerID, ""), "dstPath should not have existed")
}

View file

@ -232,10 +232,6 @@ func isCpCannotCopyDir(err error) bool {
return strings.Contains(err.Error(), archive.ErrCannotCopyDir.Error())
}
func isCpCannotCopyReadOnly(err error) bool {
return strings.Contains(err.Error(), "marked read-only")
}
func fileContentEquals(c *testing.T, filename, contents string) error {
c.Helper()