mirror of https://github.com/docker/cli.git
Merge pull request #29026 from yuexiao-wang/fix-client-test
Optimize the log info for client test
This commit is contained in:
commit
f11c4529cb
|
@ -78,10 +78,10 @@ func TestContainerStatPath(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if stat.Name != "name" {
|
if stat.Name != "name" {
|
||||||
t.Fatalf("expected container path stat name to be 'name', was '%s'", stat.Name)
|
t.Fatalf("expected container path stat name to be 'name', got '%s'", stat.Name)
|
||||||
}
|
}
|
||||||
if stat.Mode != 0700 {
|
if stat.Mode != 0700 {
|
||||||
t.Fatalf("expected container path stat mode to be 0700, was '%v'", stat.Mode)
|
t.Fatalf("expected container path stat mode to be 0700, got '%v'", stat.Mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,10 +226,10 @@ func TestCopyFromContainer(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if stat.Name != "name" {
|
if stat.Name != "name" {
|
||||||
t.Fatalf("expected container path stat name to be 'name', was '%s'", stat.Name)
|
t.Fatalf("expected container path stat name to be 'name', got '%s'", stat.Name)
|
||||||
}
|
}
|
||||||
if stat.Mode != 0700 {
|
if stat.Mode != 0700 {
|
||||||
t.Fatalf("expected container path stat mode to be 0700, was '%v'", stat.Mode)
|
t.Fatalf("expected container path stat mode to be 0700, got '%v'", stat.Mode)
|
||||||
}
|
}
|
||||||
content, err := ioutil.ReadAll(r)
|
content, err := ioutil.ReadAll(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -81,12 +81,12 @@ func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if auth != "IAmValid" {
|
if auth != "IAmValid" {
|
||||||
return nil, fmt.Errorf("Invalid auth header : expected %s, got %s", "IAmValid", auth)
|
return nil, fmt.Errorf("Invalid auth header : expected 'IAmValid', got %s", auth)
|
||||||
}
|
}
|
||||||
query := req.URL.Query()
|
query := req.URL.Query()
|
||||||
term := query.Get("term")
|
term := query.Get("term")
|
||||||
if term != "some-image" {
|
if term != "some-image" {
|
||||||
return nil, fmt.Errorf("tag not set in URL query properly. Expected '%s', got %s", "some-image", term)
|
return nil, fmt.Errorf("term not set in URL query properly. Expected 'some-image', got %s", term)
|
||||||
}
|
}
|
||||||
content, err := json.Marshal([]registry.SearchResult{
|
content, err := json.Marshal([]registry.SearchResult{
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ func TestImageSearchWithPrivilegedFuncNoError(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if len(results) != 1 {
|
if len(results) != 1 {
|
||||||
t.Fatalf("expected a result, got %v", results)
|
t.Fatalf("expected 1 result, got %v", results)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ func TestImageSearchWithoutErrors(t *testing.T) {
|
||||||
query := req.URL.Query()
|
query := req.URL.Query()
|
||||||
term := query.Get("term")
|
term := query.Get("term")
|
||||||
if term != "some-image" {
|
if term != "some-image" {
|
||||||
return nil, fmt.Errorf("tag not set in URL query properly. Expected '%s', got %s", "some-image", term)
|
return nil, fmt.Errorf("term not set in URL query properly. Expected 'some-image', got %s", term)
|
||||||
}
|
}
|
||||||
filters := query.Get("filters")
|
filters := query.Get("filters")
|
||||||
if filters != expectedFilters {
|
if filters != expectedFilters {
|
||||||
|
|
|
@ -35,7 +35,7 @@ func TestPluginPush(t *testing.T) {
|
||||||
}
|
}
|
||||||
auth := req.Header.Get("X-Registry-Auth")
|
auth := req.Header.Get("X-Registry-Auth")
|
||||||
if auth != "authtoken" {
|
if auth != "authtoken" {
|
||||||
return nil, fmt.Errorf("Invalid auth header : expected %s, got %s", "authtoken", auth)
|
return nil, fmt.Errorf("Invalid auth header : expected 'authtoken', got %s", auth)
|
||||||
}
|
}
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
|
|
Loading…
Reference in New Issue