Browse code

Optimize the log info for client test

Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>

yuexiao-wang authored on 2016/12/02 04:32:04
Showing 3 changed files
... ...
@@ -78,10 +78,10 @@ func TestContainerStatPath(t *testing.T) {
78 78
 		t.Fatal(err)
79 79
 	}
80 80
 	if stat.Name != "name" {
81
-		t.Fatalf("expected container path stat name to be 'name', was '%s'", stat.Name)
81
+		t.Fatalf("expected container path stat name to be 'name', got '%s'", stat.Name)
82 82
 	}
83 83
 	if stat.Mode != 0700 {
84
-		t.Fatalf("expected container path stat mode to be 0700, was '%v'", stat.Mode)
84
+		t.Fatalf("expected container path stat mode to be 0700, got '%v'", stat.Mode)
85 85
 	}
86 86
 }
87 87
 
... ...
@@ -226,10 +226,10 @@ func TestCopyFromContainer(t *testing.T) {
226 226
 		t.Fatal(err)
227 227
 	}
228 228
 	if stat.Name != "name" {
229
-		t.Fatalf("expected container path stat name to be 'name', was '%s'", stat.Name)
229
+		t.Fatalf("expected container path stat name to be 'name', got '%s'", stat.Name)
230 230
 	}
231 231
 	if stat.Mode != 0700 {
232
-		t.Fatalf("expected container path stat mode to be 0700, was '%v'", stat.Mode)
232
+		t.Fatalf("expected container path stat mode to be 0700, got '%v'", stat.Mode)
233 233
 	}
234 234
 	content, err := ioutil.ReadAll(r)
235 235
 	if err != nil {
... ...
@@ -81,12 +81,12 @@ func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
81 81
 				}, nil
82 82
 			}
83 83
 			if auth != "IAmValid" {
84
-				return nil, fmt.Errorf("Invalid auth header : expected %s, got %s", "IAmValid", auth)
84
+				return nil, fmt.Errorf("Invalid auth header : expected 'IAmValid', got %s", auth)
85 85
 			}
86 86
 			query := req.URL.Query()
87 87
 			term := query.Get("term")
88 88
 			if term != "some-image" {
89
-				return nil, fmt.Errorf("tag not set in URL query properly. Expected '%s', got %s", "some-image", term)
89
+				return nil, fmt.Errorf("term not set in URL query properly. Expected 'some-image', got %s",  term)
90 90
 			}
91 91
 			content, err := json.Marshal([]registry.SearchResult{
92 92
 				{
... ...
@@ -113,7 +113,7 @@ func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
113 113
 		t.Fatal(err)
114 114
 	}
115 115
 	if len(results) != 1 {
116
-		t.Fatalf("expected a result, got %v", results)
116
+		t.Fatalf("expected 1 result, got %v", results)
117 117
 	}
118 118
 }
119 119
 
... ...
@@ -133,7 +133,7 @@ func TestImageSearchWithoutErrors(t *testing.T) {
133 133
 			query := req.URL.Query()
134 134
 			term := query.Get("term")
135 135
 			if term != "some-image" {
136
-				return nil, fmt.Errorf("tag not set in URL query properly. Expected '%s', got %s", "some-image", term)
136
+				return nil, fmt.Errorf("term not set in URL query properly. Expected 'some-image', got %s",  term)
137 137
 			}
138 138
 			filters := query.Get("filters")
139 139
 			if filters != expectedFilters {
... ...
@@ -35,7 +35,7 @@ func TestPluginPush(t *testing.T) {
35 35
 			}
36 36
 			auth := req.Header.Get("X-Registry-Auth")
37 37
 			if auth != "authtoken" {
38
-				return nil, fmt.Errorf("Invalid auth header : expected %s, got %s", "authtoken", auth)
38
+				return nil, fmt.Errorf("Invalid auth header : expected 'authtoken', got %s", auth)
39 39
 			}
40 40
 			return &http.Response{
41 41
 				StatusCode: http.StatusOK,