-
Couldn't load subscription status.
- Fork 5
Minor improvements to release test framework #946
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR implements comprehensive test progress tracking and enhanced logging for the release test framework. The changes improve user experience by showing test execution progress and providing detailed environment information before test runs.
- Adds progress tracking with current test number and total test count across all suites
- Implements detailed environment logging including device lists, component versions, and test execution plans
- Refactors test execution with improved logging and duration tracking for individual tests
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
4265324 to
89895e8
Compare
89895e8 to
ebba4a4
Compare
Signed-off-by: Pau Capdevila <[email protected]>
Signed-off-by: Pau Capdevila <[email protected]>
Signed-off-by: Pau Capdevila <[email protected]>
Signed-off-by: Pau Capdevila <[email protected]>
ebba4a4 to
7ea9dba
Compare
| testCtx.pauseOnFail = rtOpts.PauseOnFail | ||
| testCtx.roceLeaves = roceLeaves | ||
|
|
||
| // Initialize progress tracking |
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: you don't need to initialize these to 0, as it is the default value for integers
| suiteRunnable := 0 | ||
| suiteSkipped := 0 | ||
|
|
||
| for _, test := range suite.TestCases { |
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.
We really shouldn't implement the skipping and selecting logic twice. Instead, please extract the current selection code from the selectAndRunSuite() function, which you can then call here; when we are ready to run them you can just call doRunTests() on the already selected suites.
| case test.Skipped != nil: | ||
| slog.Warn(" SKIP", "test", test.Name, "reason", test.Skipped.Message) | ||
| case test.Failure != nil: | ||
| slog.Error(" FAIL", "test", test.Name, "error", strings.Split(test.Failure.Message, "\n")[0]) |
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 has been changed in master to print all of the errors and replace newlines with semicolons, please update this from the existing code
|
|
||
| testCtx.currentTestNum++ | ||
| progress := "" | ||
| if testCtx.totalTests > 0 { |
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.
how can this ever be 0 if we get here?
|
|
||
| slog.Info("* Running test", "progress", progress, "test", test.Name, "suite", ts.Name) | ||
|
|
||
| if ((testCtx.currentTestNum > 1) && testCtx.wipeBetweenTests) || prevRevertsFailed { |
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 logic is not equivalent to the previous one. Previously ranSomeTests was scoped to a single suite, also because we always reset the VPCs before any suite (except noVPCs one which runs first anyway). currentTestNum however will be always > 1 after we passed the first test, regardless of a new suite. This will needlessly rerun setup-vpcs if this is say our second suite and we skipped the first test of that suite
| noVpcTestCtx.noSetup = true | ||
| noVpcSuite := makeNoVpcsSuiteRun(noVpcTestCtx) | ||
| noVpcResults, err := selectAndRunSuite(ctx, noVpcTestCtx, noVpcSuite, regexesCompiled, rtOpts.InvertRegex, skipFlags) | ||
| noVpcTestCtx.totalTests = totalRunnableTests |
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 should probably refactor this code as there's no real reason to create a new testCtx every time, we are only changing a handful of params... but until we do that, can we add these new variables as parameters to makeTestCtx, so we don't have to update them manually every time?
| case sw.Spec.Role.IsLeaf(): | ||
| leaves = append(leaves, sw.Name) | ||
| default: | ||
| // For any other roles, we can check the string representation |
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.
There are no other roles possible then the ones defined by SwitchRole - https://github.com/githedgehog/fabric/blob/83d69b2d4de3e2c3a01d2f201ac5e14ced2cecf6/api/wiring/v1beta1/switch_types.go#L38-L43 so please use it instead of contains check
| // For any other roles, we can check the string representation | ||
| roleStr := string(sw.Spec.Role) | ||
| if strings.Contains(strings.ToLower(roleStr), "border") { | ||
| borders = append(borders, sw.Name) |
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.
it's most probably going to be mixed always, we don't have dedicated borders in any envs
| roleStr := string(sw.Spec.Role) | ||
| if strings.Contains(strings.ToLower(roleStr), "border") { | ||
| borders = append(borders, sw.Name) | ||
| } else if strings.Contains(strings.ToLower(roleStr), "mgmt") { |
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.
We don't have a concept of mgmt switch
| borders := []string{} | ||
| mgmt := []string{} | ||
|
|
||
| for _, sw := range swList.Items { |
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.
It'll be probably better just to iterate over the list of switches and print them one by one with the role and any other metadata needed and then the same things for the servers/etc, but to be honest why do we need that? We have it all in the bundle for the job with versions/wirings/etc
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.
but to be honest why do we need that?
I think it is useful to have a quick summary of the system under test, in case the tester missed something and would have to redeploy/restart/retest. IMO The wiring is too much info to review each time and you could miss something not obvious
| slog.Info("───────────────────────────────────────────────────────────────────────────") | ||
|
|
||
| // Component Versions | ||
| slog.Info("Component Versions:") |
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.
That code will become outdated very quickly, we already have versions.txt in the CI bundle, and if you run it manually you can always run hhfab versions instead of having a code that'll go stale quickly.
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| noVpcSuite := makeNoVpcsSuiteRun(&VPCPeeringTestCtx{}) | ||
| singleVpcSuite := makeVpcPeeringsSingleVPCSuite(&VPCPeeringTestCtx{}) | ||
| multiVpcSuite := makeVpcPeeringsMultiVPCSuiteRun(&VPCPeeringTestCtx{}) | ||
| basicVpcSuite := makeVpcPeeringsBasicSuiteRun(&VPCPeeringTestCtx{}) |
Copilot
AI
Sep 30, 2025
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.
[nitpick] Creating empty test contexts just for suite planning creates unnecessary instances. Consider extracting the test case definitions into separate functions that don't require a test context, or add a parameter to the make functions to indicate they're being used for planning only.
| for i := 0; i < len(controls); i++ { | ||
| slog.Info(fmt.Sprintf(" control-%d: control", i)) |
Copilot
AI
Sep 30, 2025
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.
[nitpick] The loop uses a generic index i and constructs a generic name control-i. Consider using a more descriptive approach or iterating over the actual control node names if available.
| for i := 0; i < len(controls); i++ { | |
| slog.Info(fmt.Sprintf(" control-%d: control", i)) | |
| for _, control := range controls { | |
| slog.Info(fmt.Sprintf(" %s: control", control.Name)) |
Cosmetic improvements to make release tests more readable to human beings