mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
integration/image: migrate TestAPIImagesDelete to the new integration test framework
Migrated TestAPIImagesDelete from the legacy integration-cli suite (docker_api_images_test.go) to the new integration test framework under integration/image/remove_test.go. This update: - Fixes ENV instruction syntax to use "ENV FOO=bar" - Adds error type check using errdefs.IsNotFound for cleaner assertions - Ensures consistent cleanup handling Signed-off-by: Aditya Mishra <mishraaditya675@gmail.com>
This commit is contained in:
@@ -36,30 +36,6 @@ func (s *DockerAPISuite) TestAPIImagesSaveAndLoad(c *testing.T) {
|
||||
assert.Equal(c, strings.TrimSpace(inspectOut), id, "load did not work properly")
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TestAPIImagesDelete(c *testing.T) {
|
||||
apiClient, err := client.New(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
|
||||
if testEnv.DaemonInfo.OSType != "windows" {
|
||||
testRequires(c, Network)
|
||||
}
|
||||
name := "test-api-images-delete"
|
||||
cli.BuildCmd(c, name, build.WithDockerfile("FROM busybox\nENV FOO bar"))
|
||||
id := getIDByName(c, name)
|
||||
|
||||
cli.DockerCmd(c, "tag", name, "test:tag1")
|
||||
|
||||
_, err = apiClient.ImageRemove(testutil.GetContext(c), id, client.ImageRemoveOptions{})
|
||||
assert.ErrorContains(c, err, "unable to delete")
|
||||
|
||||
_, err = apiClient.ImageRemove(testutil.GetContext(c), "test:noexist", client.ImageRemoveOptions{})
|
||||
assert.ErrorContains(c, err, "No such image")
|
||||
|
||||
_, err = apiClient.ImageRemove(testutil.GetContext(c), "test:tag1", client.ImageRemoveOptions{})
|
||||
assert.NilError(c, err)
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TestAPIImagesImportBadSrc(c *testing.T) {
|
||||
testRequires(c, Network, testEnv.IsLocalDaemon)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user