Skip to content

Conversation

@pau-hedgehog
Copy link
Contributor

@pau-hedgehog pau-hedgehog commented Sep 8, 2025

Cosmetic improvements to make release tests more readable to human beings

@pau-hedgehog pau-hedgehog requested a review from Copilot September 8, 2025 22:14
@pau-hedgehog pau-hedgehog self-assigned this Sep 8, 2025
@pau-hedgehog pau-hedgehog added ci:-upgrade Disable VLAB upgrade tests ci:+release Enable VLAB release tests ci:+hlab Enable hybrid VLAB tests labels Sep 8, 2025
Copy link

Copilot AI left a 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.

@pau-hedgehog pau-hedgehog changed the title Pau/release test dx Minor improvements to release test framework Sep 9, 2025
@pau-hedgehog pau-hedgehog marked this pull request as ready for review September 10, 2025 07:15
@pau-hedgehog pau-hedgehog requested a review from a team as a code owner September 10, 2025 07:15
testCtx.pauseOnFail = rtOpts.PauseOnFail
testCtx.roceLeaves = roceLeaves

// Initialize progress tracking
Copy link
Contributor

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 {
Copy link
Contributor

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])
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Member

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)
Copy link
Member

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") {
Copy link
Member

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 {
Copy link
Member

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

Copy link
Contributor Author

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:")
Copy link
Member

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.

@pau-hedgehog pau-hedgehog removed the ci:+hlab Enable hybrid VLAB tests label Sep 15, 2025
@pau-hedgehog pau-hedgehog marked this pull request as draft September 19, 2025 10:25
@Frostman Frostman requested a review from Copilot September 30, 2025 20:54
Copy link

Copilot AI left a 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.

Comment on lines +3083 to +3086
noVpcSuite := makeNoVpcsSuiteRun(&VPCPeeringTestCtx{})
singleVpcSuite := makeVpcPeeringsSingleVPCSuite(&VPCPeeringTestCtx{})
multiVpcSuite := makeVpcPeeringsMultiVPCSuiteRun(&VPCPeeringTestCtx{})
basicVpcSuite := makeVpcPeeringsBasicSuiteRun(&VPCPeeringTestCtx{})
Copy link

Copilot AI Sep 30, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +3214 to +3215
for i := 0; i < len(controls); i++ {
slog.Info(fmt.Sprintf(" control-%d: control", i))
Copy link

Copilot AI Sep 30, 2025

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.

Suggested change
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))

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:-upgrade Disable VLAB upgrade tests ci:+release Enable VLAB release tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants