Skip to content

test: Configurable memory and disk size on test suites - #5269

Open
albfan wants to merge 1 commit into
crc-org:mainfrom
albfan:disk-size
Open

test: Configurable memory and disk size on test suites#5269
albfan wants to merge 1 commit into
crc-org:mainfrom
albfan:disk-size

Conversation

@albfan

@albfan albfan commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Allow both test suite to manage memory and disk-size properties without relay on default values, as bundles might force a change still not present in crc

Description

Configurable properties for both test suites

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Proposed changes

CI can configure memory or disk-size

Testing

Use new defined properties

Contribution Checklist

  • I Keep It Small and Simple: The smaller the PR is, the easier it is to review and have it merged
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Which platform have you tested the code changes on?
    • Linux
    • Windows
    • MacOS

Summary by CodeRabbit

Release Notes

  • Chores
    • E2E test runners now support customizable CRC disk size configuration across all platforms
    • Integration test runners now support customizable CRC memory and disk size settings across all platforms

Allow both test suite to manage memory and disk-size properties without
relay on default values, as bundles might force a change still not
present in crc
@openshift-ci

openshift-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign evidolob for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR threads --crc-disk-size through e2e test runners and suite, and --crc-memory plus --crc-disk-size through integration test runners and suite. Build scripts parse parameters and forward them to test binaries; test suites register the flags and apply them to CRC VM configuration.

Changes

E2E Test Disk Size Configuration

Layer / File(s) Summary
E2E runner scripts disk-size parameter threading
images/build-e2e/lib/darwin/run.sh, images/build-e2e/lib/linux/run.sh, images/build-e2e/lib/windows/run.ps1
Darwin, Linux, and Windows e2e runner scripts now parse -crcDiskSize argument and forward it to e2e.test invocation via --crc-disk-size flag.
E2E test suite disk-size support
test/e2e/testsuite/testsuite.go
E2E test suite registers --crc-disk-size flag, stores value in exported variable CRCDiskSize, and conditionally applies disk-size configuration to CRC VM during EnsureCRCIsRunning setup.

Integration Test Memory and Disk Size Configuration

Layer / File(s) Summary
Integration runner scripts memory and disk-size parameter threading
images/build-integration/lib/darwin/run.sh, images/build-integration/lib/linux/run.sh, images/build-integration/lib/windows/run.ps1
Darwin, Linux, and Windows integration runner scripts now parse -crcMemory and -crcDiskSize arguments, build extraFlags conditionally, and forward them to integration.test invocation via --crc-memory and --crc-disk-size flags.
Integration test suite memory and disk-size support
test/integration/testsuite_test.go
Integration test suite registers --crc-memory and --crc-disk-size flags, stores values in package variables, and conditionally applies memory and disk-size configuration to CRC VM via RunCRCExpectSuccess calls during BeforeSuite setup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • crc-org/crc#5116: Both PRs adjust the CRC VM's disk-size setting used by e2e tests; this PR wires a --crc-disk-size flag through the test runner and suite, while #5116 hardcodes a feature step to set disk-size to 40.

Suggested reviewers

  • adrianriobo

Poem

🐇 A disk to grow, a memory to hold,
Through scripts and suites the flags take hold,
From darwin's shell to windows' spark,
CRC's resources light the dark! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is incomplete. While it identifies the feature and checks some boxes, it lacks detailed explanations of proposed changes and testing procedures required by the template. Expand 'Proposed changes' with specific implementation details and provide detailed testing steps verifying the new configurable properties work correctly.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding configurable memory and disk size options to test suites.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/testsuite/testsuite.go`:
- Around line 900-905: The cleanup path currently unsets memory/preset but not
disk-size, so add a cleanup call to revert disk-size to avoid config leakage
between scenarios; locate the `@cleanup` block and call
SetConfigPropertyToValueSucceedsOrFails with "disk-size" and an empty value
(e.g. SetConfigPropertyToValueSucceedsOrFails("disk-size", "", "succeeds")) so
the disk-size key is removed/restored during teardown.
- Around line 900-905: CheckCRCStatusJSONOutput currently compares the
JSON-reported disk size to constants.DefaultDiskSize even when
EnsureCRCIsRunning/SetConfigPropertyToValueSucceedsOrFails set a custom
CRCDiskSize; update CheckCRCStatusJSONOutput to honor CRCDiskSize (use
CRCDiskSize when non-empty, fallback to constants.DefaultDiskSize) when
validating the disk-size field from crc status -ojson, ensuring any unit/format
normalization matches how CRCDiskSize is provided.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 18180cba-5dc6-4543-b452-f66e9b180819

📥 Commits

Reviewing files that changed from the base of the PR and between de1a9b9 and f837185.

📒 Files selected for processing (8)
  • images/build-e2e/lib/darwin/run.sh
  • images/build-e2e/lib/linux/run.sh
  • images/build-e2e/lib/windows/run.ps1
  • images/build-integration/lib/darwin/run.sh
  • images/build-integration/lib/linux/run.sh
  • images/build-integration/lib/windows/run.ps1
  • test/e2e/testsuite/testsuite.go
  • test/integration/testsuite_test.go

Comment on lines +900 to +905
if CRCDiskSize != "" {
err = SetConfigPropertyToValueSucceedsOrFails("disk-size", CRCDiskSize, "succeeds")
if err != nil {
return err
}
}

@coderabbitai coderabbitai Bot Jun 12, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Unset disk-size in the @cleanup path too.

This now persists disk-size into CRC config, but the cleanup block only unsets memory, preset, and the older keys. After one scenario runs with a custom disk size, later scenarios can inherit that value from ~/.crc, which breaks suite isolation.

Suggested follow-up
 				err = crcCmd.UnsetConfigPropertySucceedsOrFails("memory", "succeeds") // unsetting property that is not set gives 0 exitcode, so this works
 				if err != nil {
 					fmt.Println(err)
 					os.Exit(1)
 				}
+
+				err = crcCmd.UnsetConfigPropertySucceedsOrFails("disk-size", "succeeds")
+				if err != nil {
+					fmt.Println(err)
+					os.Exit(1)
+				}
 
 				err = crcCmd.UnsetConfigPropertySucceedsOrFails("preset", "succeeds") // unsetting property that is not set gives 0 exitcode, so this works
 				if err != nil {
 					fmt.Println(err)
 					os.Exit(1)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/testsuite/testsuite.go` around lines 900 - 905, The cleanup path
currently unsets memory/preset but not disk-size, so add a cleanup call to
revert disk-size to avoid config leakage between scenarios; locate the `@cleanup`
block and call SetConfigPropertyToValueSucceedsOrFails with "disk-size" and an
empty value (e.g. SetConfigPropertyToValueSucceedsOrFails("disk-size", "",
"succeeds")) so the disk-size key is removed/restored during teardown.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make crc status -ojson validation honor the configured disk size.

EnsureCRCIsRunning() can now start CRC with a non-default disk-size, but CheckCRCStatusJSONOutput() still compares against constants.DefaultDiskSize. Any suite that sets --crc-disk-size below the default will fail that validation even when CRC was configured correctly.

Suggested follow-up
 	crcDiskSize := crcStatusJSONOutputObj["diskSize"]
-	if strongunits.GiB(cast.ToUint64(crcDiskSize)) < strongunits.GiB(constants.DefaultDiskSize-1) {
+	expectedDiskSize := constants.DefaultDiskSize
+	if CRCDiskSize != "" {
+		if parsed, err := strconv.Atoi(CRCDiskSize); err == nil {
+			expectedDiskSize = parsed
+		}
+	}
+	if strongunits.GiB(cast.ToUint64(crcDiskSize)) < strongunits.GiB(expectedDiskSize-1) {
 		// This is a workaround for the fact that crc status json output
 		// which doesn't return the actual disk size, but rather the
 		// size of `/sysroot` mount, which is less than the actual disk size.
-		return fmt.Errorf("failure in asserting 'diskSize' field of crc status json output, expected greater than or equal to %d bytes, actual : %d bytes", strongunits.GiB(constants.DefaultDiskSize).ToBytes(), strongunits.B(cast.ToUint64(crcDiskSize)))
+		return fmt.Errorf("failure in asserting 'diskSize' field of crc status json output, expected greater than or equal to %d bytes, actual : %d bytes", strongunits.GiB(expectedDiskSize).ToBytes(), strongunits.B(cast.ToUint64(crcDiskSize)))
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/testsuite/testsuite.go` around lines 900 - 905,
CheckCRCStatusJSONOutput currently compares the JSON-reported disk size to
constants.DefaultDiskSize even when
EnsureCRCIsRunning/SetConfigPropertyToValueSucceedsOrFails set a custom
CRCDiskSize; update CheckCRCStatusJSONOutput to honor CRCDiskSize (use
CRCDiskSize when non-empty, fallback to constants.DefaultDiskSize) when
validating the disk-size field from crc status -ojson, ensuring any unit/format
normalization matches how CRCDiskSize is provided.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albfan this looks right?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, need to rework this part

@praveenkumar

Copy link
Copy Markdown
Member

@albfan can we update it or this is no longer required?

@albfan

albfan commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

I think It will be good to have

@praveenkumar

Copy link
Copy Markdown
Member

I think It will be good to have

In that case let's update this PR as per #5269 (comment) review.

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 this pull request may close these issues.

2 participants