Skip to content
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

Improve service startup test to check the completion #42

Closed
MonicaisHer opened this issue Feb 16, 2024 · 0 comments · Fixed by #46
Closed

Improve service startup test to check the completion #42

MonicaisHer opened this issue Feb 16, 2024 · 0 comments · Fixed by #46

Comments

@MonicaisHer
Copy link
Contributor

MonicaisHer commented Feb 16, 2024

This starts the services and checks their status. The snap start operation returns once the oneshot setup service exits. These are all operations that are taken care of by snapd. So in a sense, only the successful completion of the oneshot service is being tested here.
What could make this test more useful is to check if the services complete their startup in a reasonable amount of time (by looking for some reference in the logs), or if they fail.

Originally posted by @farshidtz in #40 (comment)

utils.SnapStart(nil, otbrSnap)
// Oneshot service
require.False(t, utils.SnapServicesActive(t, otbrSetupApp))
// Active services
require.True(t, utils.SnapServicesActive(t, otbrWebApp))
require.True(t, utils.SnapServicesActive(t, otbrAgentApp))

In the above test, we are checking the active status of the snap service for the oneshot service and active services. The test could be updated to also check if each service starts up completely within a reasonable time duration.

The utils.WaitForLogMessage() function could be used here to check compeletion by verifying the log message, with the default 10 seconds duration. If needed, the duration could be increased by passing an argument maxRetry to utils.WaitForLogMessage() as documented there.

@MonicaisHer MonicaisHer changed the title Improve service startup service to check the completion Improve service startup test to check the completion Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant