-
Notifications
You must be signed in to change notification settings - Fork 203
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
Add command to show historical runs of porter #1779
Add command to show historical runs of porter #1779
Conversation
b027566
to
47d0e42
Compare
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 looks great! 💯 Once we have the performance concern addressed and a test for the output, it should be good to go.
"testing" | ||
) | ||
|
||
func TestPorter_ListInstallationRuns(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 is a good test. Let's add one more testcase for checking the formatted command output.
The tests for porter installation show
in pkg/porter/show_test.go demonstrate how to write a test that checks that the printed output looks the way that you expect. It captures the output from the command, and then compares it against expected output in a file.
The p.CompareGoldenFile
function assists with updating the contents of those test files to match the current test output (which is helpful when you intentionally change the output of those commands). Once the test files exist, you can run mage updateTestFiles
and all of those test files will be synced with the current output.
The tricky part with those tests is making sure that timestamps do not cause the output to be different every time that you run the test. So the test uses fixed timestamps to make comparing the outputs easier.
i := p.TestClaims.CreateInstallation(claims.NewInstallation("dev", "mywordpress"), p.TestClaims.SetMutableInstallationValues
The SetMutableInstallationValues function (there is also SetMutableRunValues, and SetMutableResultValues) updates the timestamps and IDs so that the tests are reproducible.
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 great, thanks for improving the performance of that function.
We just need to get the test that checks the command output figured out and it will be all set.
Signed-off-by: Phillip Ahereza <pahereza@gmail.com>
6db9eba
to
6193eb4
Compare
@@ -0,0 +1,42 @@ | |||
[ |
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.
Something about how the test is being set up isn't quite right. This file should be the output that someone would see if they ran the command and didn't set the format (i.e. what you see in your screenshot). It shouldn't be json.
Same for the yaml output test case.
Signed-off-by: Phillip Ahereza <pahereza@gmail.com>
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.
Great, the test looks good. I just built it and ran everything locally and it's working just like we hoped. Thank you for adding this to Porter! 💯
The one failing test (the windows smoke test) is unrelated to your PR and is fixed on the v1 branch, so that can be ignored.
What does this change
Adds the command
porter installation runs list [NAME] [--namespace NAMESPACE] [--output FORMAT]
that lists the historical runs for an installationWhat issue does it fix
Closes #1699
Notes for the reviewer
N/A
Checklist