-
Notifications
You must be signed in to change notification settings - Fork 950
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: fix some bugs for test #2504
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2504 +/- ##
==========================================
- Coverage 69.31% 65.06% -4.25%
==========================================
Files 278 278
Lines 18387 18387
==========================================
- Hits 12745 11964 -781
- Misses 4213 5128 +915
+ Partials 1429 1295 -134
|
test/cli_inspect_test.go
Outdated
@@ -36,6 +36,26 @@ func (suite *PouchInspectSuite) TearDownTest(c *check.C) { | |||
// TestInspectCreateAndStartedFormat is to verify the format flag of inspect command. | |||
func (suite *PouchInspectSuite) TestInspectCreateAndStartedFormat(c *check.C) { | |||
name := "TestInspectCreateAndStartedFormat" | |||
// get root dir | |||
ret := command.PouchRun("info") |
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.
Maybe we can wrap this logic to a function GetRootDir
?
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.
get it
please rebase your code |
add start lxcfs get the root dir of pouch daemon, instead of `/var/lib/pouch` modify ipv6 test for alikernel Signed-off-by: Rudy Zhang <rudyflyzhang@gmail.com>
@@ -68,7 +73,7 @@ func (suite *PouchInspectSuite) TestInspectCreateAndStartedFormat(c *check.C) { | |||
// Inspect LogPath, LogPath should not be empty after container's start. | |||
// by default, the container has log type of json-file. | |||
output = command.PouchRun("inspect", "-f", "{{.LogPath}}", name).Stdout() | |||
expectedLogPath := fmt.Sprintf("/var/lib/pouch/containers/%s/json.log", containerID) |
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 search in pouch , find more hard code /var/lib/pouch
, maybe we can fix in this pr to replace it use this func?
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 can't find anyone in testcase....Can you give a case?
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 mean in whole project can do as the same way, not only the testcase.
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've searched the whole project. Actually, /var/lib/pouch
occurred in 5 go file.
One of them is the default config of pouchd. Two of them is the default config of storage.
Two of them inside the test.
First one, a mock test, acceptable.
https://github.com/alibaba/pouch/blob/1f7dbf60d406210c65fb96ea4682f6d04f97773e/client/system_info_test.go#L40
Second one, a hard code path in cli test.
https://github.com/alibaba/pouch/blob/638b38fa9a09ae52922a900d611817b69e017d7c/test/cli_inspect_test.go#L71
I think this one could use GetRootDir
function for more generality. Actually, this one was fixed in this PR.
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.
LGTM @zhuangqh thanks for your check.
LGTM |
Ⅰ. Describe what this PR did
add start lxcfs
get the root dir of pouch daemon, instead of
/var/lib/pouch
modify ipv6 test for alikernel
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Just modify test
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
Signed-off-by: Rudy Zhang rudyflyzhang@gmail.com