-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor tests, improve logging #45
Conversation
if err != nil { | ||
t.Fatalf("Error starting application: %s\n", err) | ||
} | ||
func TestAllClustersApp(t *testing.T) { |
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.
This function's purpose is to test the commission and control function of the chip-tool. AllClustersApp is only a helper snap here, rather than the main purpose. How about updating the function name to something such as TestCommissionAndControl()
?
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 agree. However, the full test do end up having meaningful names:
--- PASS: TestAllClustersApp (3.34s)
--- PASS: TestAllClustersApp/Commission (0.98s)
--- PASS: TestAllClustersApp/Control (1.35s)
An accurate parent test function name could be TestCommissionAndControlAllClustersApp
because it is testing commission and control of that app rather than some mocked generic target. But that is a very long name and mostly redundant when combined with subtest names.
tests/snap_test.go
Outdated
}) | ||
} | ||
|
||
func waitForLogMessage(t *testing.T, logPath, expectedMsg string, since time.Time) { |
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.
To distinguish this function from utils.WaitForLogMessage()
:
func waitForLogMessage(t *testing.T, logPath, expectedMsg string, since time.Time) { | |
func waitForLocalLogFileMessage(t *testing.T, logPath, expectedMsg string, since time.Time) { |
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.
The function signatures are distinct, and this doesn't wait for a "local log file message". I'd keep this name unless there is a better suggestion.
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.
The environment variables used on this test suite are undocumented. They are mainly realted to matter-snap-testing, but would be good to add a reference link once this issue was solved:
canonical/matter-snap-testing#14
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.
Despite the minor suggestions, everything looks good!
Thanks for pointing this out. However, these aren't related to changes made in this PR. I'm going to create a separate issue. |
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.
Everything looks good! Thank you!
Closes #33
Use new util functions from canonical/matter-snap-testing#11