-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove code duplication and consolidate networkIsRemoved
This fix removes code duplication and consolidates networkIsRemoved into one place. Signed-off-by: Yong Tang <[email protected]>
- Loading branch information
Showing
3 changed files
with
25 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package network | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/docker/docker/api/types" | ||
"github.com/docker/docker/client" | ||
"gotest.tools/poll" | ||
) | ||
|
||
// IsRemoved verifies the network is removed. | ||
func IsRemoved(ctx context.Context, client client.NetworkAPIClient, networkID string) func(log poll.LogT) poll.Result { | ||
return func(log poll.LogT) poll.Result { | ||
_, err := client.NetworkInspect(ctx, networkID, types.NetworkInspectOptions{}) | ||
if err == nil { | ||
return poll.Continue("waiting for network %s to be removed", networkID) | ||
} | ||
return poll.Success() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters