From aa9817b0c518f827032ebced22c10933bf288341 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 27 Feb 2025 22:03:08 +0100 Subject: [PATCH] testutil: remove isErrNotFoundSwarmClassic Signed-off-by: Sebastiaan van Stijn --- testutil/environment/clean.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/testutil/environment/clean.go b/testutil/environment/clean.go index 4912dc435c..af821cca7f 100644 --- a/testutil/environment/clean.go +++ b/testutil/environment/clean.go @@ -81,7 +81,7 @@ func deleteAllContainers(ctx context.Context, t testing.TB, apiclient client.Con Force: true, RemoveVolumes: true, }) - if err == nil || errdefs.IsNotFound(err) || alreadyExists.MatchString(err.Error()) || isErrNotFoundSwarmClassic(err) { + if err == nil || errdefs.IsNotFound(err) || alreadyExists.MatchString(err.Error()) { continue } assert.Check(t, err, "failed to remove %s", ctr.ID) @@ -140,10 +140,6 @@ func deleteAllVolumes(ctx context.Context, t testing.TB, c client.VolumeAPIClien continue } err := c.VolumeRemove(ctx, v.Name, true) - // Docker EE may list volumes that no longer exist. - if isErrNotFoundSwarmClassic(err) { - continue - } assert.Check(t, err, "failed to remove volume %s", v.Name) } } @@ -186,9 +182,3 @@ func deleteAllPlugins(ctx context.Context, t testing.TB, c client.PluginAPIClien assert.Check(t, err, "failed to remove plugin %s", p.ID) } } - -// Swarm classic aggregates node errors and returns a 500 so we need to check -// the error string instead of just IsErrNotFound(). -func isErrNotFoundSwarmClassic(err error) bool { - return err != nil && strings.Contains(strings.ToLower(err.Error()), "no such") -}