-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat(e2e): Add 'pkg source/unsource' tests #817
feat(e2e): Add 'pkg source/unsource' tests #817
Conversation
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
4c41358
to
8289757
Compare
8289757
to
cbb73ad
Compare
// https://www.regular-expressions.info/nonprint.html | ||
// https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 | ||
Expect(stdout.String()).To(MatchRegexp(`\x1b\[2K\[\+\] Updating\.\.\. \[\d+\.\d+s\]\r\n`), "Quoted output: %q", stdout) | ||
Expect(stdout.String()).To(MatchRegexp(`^{"level":"info","msg":"Updating..."}\n$`)) |
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.
nit: We could as well use Equal()
here if we are gating the string between ^$
.
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.
Nit rejected, it makes the test fail with a strange error (the strings are equal), probably whitespace related, but let's just leave it like this
Same for the others
@@ -67,7 +67,7 @@ var _ = Describe("kraft version", func() { | |||
|
|||
Expect(stderr.String()).To(BeEmpty()) | |||
Expect(stdout.String()).To(MatchRegexp( | |||
`^(level=error msg="unknown command "some-arg" for "kraft version"")|(unknown command "some-arg" for "kraft version")\n$`, | |||
`^{"level":"error","msg":"unknown command \\"some-arg\\" for \\"kraft version\\""}\n$`, |
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.
nit: We could as well use Equal()
here if we are gating the string between ^$
.
Expect(stderr.String()).To(BeEmpty()) | ||
|
||
// Check warning message exists in stdout | ||
Expect(stdout.String()).To(MatchRegexp(`^{"level":"warning","msg":"manifest already saved: https://manifests\.kraftkit\.sh/index\.yaml"}\n$`)) |
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.
nit: We could as well use Equal()
here if we are gating the string between ^$
.
Expect(cfgMapUnikernelManifests[1]).To(Equal("https://example.com")) | ||
|
||
// Check if stdout contains the warning message | ||
Expect(stdout.String()).To(MatchRegexp(`^{"level":"warning","msg":"manifest already saved: https://example\.com"}\n$`)) |
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.
nit: We could as well use Equal()
here if we are gating the string between ^$
.
Expect(cfgMapUnikernelManifests[0]).To(Equal("https://manifests.kraftkit.sh/index.yaml")) | ||
|
||
// Check if stdout contains the warning | ||
Expect(stdout.String()).To(MatchRegexp(`^{"level":"warning","msg":"manifest not found: https://example\.com"}\n$`)) |
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.
nit: We could as well use Equal()
here if we are gating the string between ^$
.
Expect(cfgMapUnikernelManifests[1]).To(Equal("https://example3.com")) | ||
|
||
// Check if stdout has a warning | ||
Expect(stdout.String()).To(MatchRegexp(`^{"level":"warning","msg":"manifest not found: https://example2\.com"}\n$`)) |
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.
nit: We could as well use Equal()
here if we are gating the string between ^$
.
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
cbb73ad
to
95e8aa6
Compare
Prerequisite checklist
make fmt
on your commit series before opening this PR;Description of changes
GitHub-Fixes: #735