github.com/powellquiring/docker@v1.6.0-rc1/integration-cli/docker_cli_inspect_test.go (about)

     1  package main
     2  
     3  import (
     4  	"os/exec"
     5  	"strings"
     6  	"testing"
     7  )
     8  
     9  func TestInspectImage(t *testing.T) {
    10  	imageTest := "emptyfs"
    11  	imageTestID := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"
    12  	imagesCmd := exec.Command(dockerBinary, "inspect", "--format='{{.Id}}'", imageTest)
    13  	out, exitCode, err := runCommandWithOutput(imagesCmd)
    14  	if exitCode != 0 || err != nil {
    15  		t.Fatalf("failed to inspect image: %s, %v", out, err)
    16  	}
    17  
    18  	if id := strings.TrimSuffix(out, "\n"); id != imageTestID {
    19  		t.Fatalf("Expected id: %s for image: %s but received id: %s", imageTestID, imageTest, id)
    20  	}
    21  
    22  	logDone("inspect - inspect an image")
    23  }