Пример #1
0
func assertNImages(graph *graph.Graph, t *testing.T, n int) {
	if images, err := graph.Map(); err != nil {
		t.Fatal(err)
	} else if actualN := len(images); actualN != n {
		t.Fatalf("Expected %d images, found %d", n, actualN)
	}
}
Пример #2
0
func createTestImage(graph *graph.Graph, t *testing.T) *image.Image {
	archive, err := fakeTar()
	if err != nil {
		t.Fatal(err)
	}
	img, err := graph.Create(archive, "", "", "Test image", "", nil, nil)
	if err != nil {
		t.Fatal(err)
	}
	return img
}
Пример #3
0
func checkIsParent(id, parent string, g *graph.Graph) (bool, error) {
	isParent := false
	img, err := g.Get(id)
	if err != nil {
		return false, err
	}

	for {
		if img.Parent == "" {
			break
		}

		if img.Parent == parent {
			isParent = true
			break
		}

		img, err = g.Get(img.Parent)
		if err != nil {
			break
		}
	}
	return isParent, err
}
Пример #4
0
func nukeGraph(graph *graph.Graph) {
	graph.Driver().Cleanup()
	os.RemoveAll(graph.Root)
}