mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Cleanup errorOut resp in inspect tests
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
This commit is contained in:
		
							parent
							
								
									d33f2bdb11
								
							
						
					
					
						commit
						ac24cabd9d
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -2,7 +2,6 @@ package main
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -10,7 +9,9 @@ import (
 | 
			
		|||
func TestInspectApiContainerResponse(t *testing.T) {
 | 
			
		||||
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true")
 | 
			
		||||
	out, _, err := runCommandWithOutput(runCmd)
 | 
			
		||||
	errorOut(err, t, fmt.Sprintf("failed to create a container: %v %v", out, err))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatalf("failed to create a container: %s, %v", out, err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cleanedContainerID := stripTrailingCharacters(out)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,13 +10,14 @@ func TestInspectImage(t *testing.T) {
 | 
			
		|||
	imageTest := "scratch"
 | 
			
		||||
	imageTestID := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"
 | 
			
		||||
	imagesCmd := exec.Command(dockerBinary, "inspect", "--format='{{.Id}}'", imageTest)
 | 
			
		||||
 | 
			
		||||
	out, exitCode, err := runCommandWithOutput(imagesCmd)
 | 
			
		||||
	if exitCode != 0 || err != nil {
 | 
			
		||||
		t.Fatalf("failed to inspect image")
 | 
			
		||||
		t.Fatalf("failed to inspect image: %s, %v", out, err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if id := strings.TrimSuffix(out, "\n"); id != imageTestID {
 | 
			
		||||
		t.Fatalf("Expected id: %s for image: %s but received id: %s", imageTestID, imageTest, id)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logDone("inspect - inspect an image")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue