github.com/christopherobin/docker@v1.6.2/volumes/volume_test.go (about)

     1  package volumes
     2  
     3  import "testing"
     4  
     5  func TestContainers(t *testing.T) {
     6  	v := &Volume{containers: make(map[string]struct{})}
     7  	id := "1234"
     8  
     9  	v.AddContainer(id)
    10  
    11  	if v.Containers()[0] != id {
    12  		t.Fatalf("adding a container ref failed")
    13  	}
    14  
    15  	v.RemoveContainer(id)
    16  	if len(v.Containers()) != 0 {
    17  		t.Fatalf("removing container failed")
    18  	}
    19  }