-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test:add container create test #1106
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1106 +/- ##
==========================================
+ Coverage 15.8% 16.75% +0.94%
==========================================
Files 163 165 +2
Lines 8793 8906 +113
==========================================
+ Hits 1390 1492 +102
- Misses 7300 7308 +8
- Partials 103 106 +3
|
httpClient := newMockClient(func(req *http.Request) (*http.Response, error) { | ||
if !strings.HasPrefix(req.URL.Path, expectedURL) { | ||
return nil, fmt.Errorf("expected URL '%s', got '%s'", expectedURL, req.URL) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test can be enhanced. Would you check the type of the request or the data type that the request method gets, which can improve the degree of accuracy greatly. Thx a lot!
client/container_create_test.go
Outdated
} | ||
if container.ID != "container_id" { | ||
t.Fatalf("expected `container_id`, got %s", container.ID) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can assert the value of both id and name here, instead of just that of id.
You can refer to similar mock test, such as 'network create' and 'volume create'. |
Signed-off-by: Dewey-Ding <deweyding@gmail.com>
@ZouRui89 PTAL |
Well done! LGTM |
Signed-off-by: Dewey-Ding deweyding@gmail.com
Ⅰ. Describe what this PR did
add container create test
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews