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>
| ... | ... |
@@ -411,9 +411,7 @@ func (s *DockerCLICpSuite) TestCpToErrReadOnlyRootfs(c *testing.T) {
|
| 411 | 411 |
dstPath := containerCpPath(containerID, "/root/shouldNotExist") |
| 412 | 412 |
|
| 413 | 413 |
err := runDockerCp(c, srcPath, dstPath) |
| 414 |
- assert.ErrorContains(c, err, "") |
|
| 415 |
- |
|
| 416 |
- assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrContainerRootfsReadonly error, but got %T: %s", err, err) |
|
| 414 |
+ assert.ErrorContains(c, err, "marked read-only") |
|
| 417 | 415 |
assert.NilError(c, containerStartOutputEquals(c, containerID, ""), "dstPath should not have existed") |
| 418 | 416 |
} |
| 419 | 417 |
|
| ... | ... |
@@ -436,8 +434,7 @@ func (s *DockerCLICpSuite) TestCpToErrReadOnlyVolume(c *testing.T) {
|
| 436 | 436 |
dstPath := containerCpPath(containerID, "/vol_ro/shouldNotExist") |
| 437 | 437 |
|
| 438 | 438 |
err := runDockerCp(c, srcPath, dstPath) |
| 439 |
- assert.ErrorContains(c, err, "") |
|
| 439 |
+ assert.ErrorContains(c, err, "marked read-only") |
|
| 440 | 440 |
|
| 441 |
- assert.Assert(c, isCpCannotCopyReadOnly(err), "expected ErrVolumeReadonly error, but got %T: %s", err, err) |
|
| 442 | 441 |
assert.NilError(c, containerStartOutputEquals(c, containerID, ""), "dstPath should not have existed") |
| 443 | 442 |
} |
| ... | ... |
@@ -232,10 +232,6 @@ func isCpCannotCopyDir(err error) bool {
|
| 232 | 232 |
return strings.Contains(err.Error(), archive.ErrCannotCopyDir.Error()) |
| 233 | 233 |
} |
| 234 | 234 |
|
| 235 |
-func isCpCannotCopyReadOnly(err error) bool {
|
|
| 236 |
- return strings.Contains(err.Error(), "marked read-only") |
|
| 237 |
-} |
|
| 238 |
- |
|
| 239 | 235 |
func fileContentEquals(c *testing.T, filename, contents string) error {
|
| 240 | 236 |
c.Helper() |
| 241 | 237 |
|