github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/integration/internal/network/states.go (about)

     1  package network
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/demonoid81/moby/api/types"
     7  	"github.com/demonoid81/moby/client"
     8  	"gotest.tools/v3/poll"
     9  )
    10  
    11  // IsRemoved verifies the network is removed.
    12  func IsRemoved(ctx context.Context, client client.NetworkAPIClient, networkID string) func(log poll.LogT) poll.Result {
    13  	return func(log poll.LogT) poll.Result {
    14  		_, err := client.NetworkInspect(ctx, networkID, types.NetworkInspectOptions{})
    15  		if err == nil {
    16  			return poll.Continue("waiting for network %s to be removed", networkID)
    17  		}
    18  		return poll.Success()
    19  	}
    20  }