Skip to content

Add typed K8s resource helpers and cluster-level export e2e tests (MTA-851–855)#576

Merged
RanWurmbrand merged 3 commits into
migtools:mainfrom
RanWurmbrand:infra/resources-and-tests
Jun 29, 2026
Merged

Add typed K8s resource helpers and cluster-level export e2e tests (MTA-851–855)#576
RanWurmbrand merged 3 commits into
migtools:mainfrom
RanWurmbrand:infra/resources-and-tests

Conversation

@RanWurmbrand

@RanWurmbrand RanWurmbrand commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

closes: #579, closes: #578, closes:#334, closes:#333, closes:#332

Summary

  • Introduces Resource interface with Create/Delete methods for consistent K8s resource lifecycle management in tests
  • Adds typed helpers: ClusterRole, ClusterRoleBinding, ServiceAccount, CustomResourceDefinition, CustomResource, Namespace
  • Adds ResourceCleanup for multi-cluster test teardown
  • Adds ValidateClusterRBAC helper for verifying cluster role bindings on target
  • Adds ReadTestdataFile utility for loading test fixtures

New Tests

Test Description
MTA-851 Verifies no _cluster directory for namespace-only workloads
MTA-852 ClusterRole/ClusterRoleBinding export for linked ServiceAccount
MTA-853 Namespace-admin split-apply (cluster + namespace resources)
MTA-854 Two ClusterRoles/ClusterRoleBindings for one Deployment
MTA-855 CRD export to _cluster, custom resource to namespace directory

Test plan

  • Run tier0 tests: ginkgo -v --label-filter="tier0" ./e2e-tests/...
  • Run tier1 tests: ginkgo -v --label-filter="tier1" ./e2e-tests/...
  • Verify cluster-admin tests pass with appropriate kubeconfig
  • Verify namespace-admin test (MTA-853) skips gracefully without non-admin context

Summary by CodeRabbit

Summary

  • New Features
    • Added Tier0/Tier1 end-to-end scenarios for cluster-level export control, RBAC export, split-apply behavior, and CRD/Custom Resource migration.
    • Added reusable Kubernetes e2e resource helpers and a utility to validate exported ClusterRoleBindings and subjects.
    • Introduced widget CR/CRD test manifests and a file-existence assertion to confirm expected export outputs.
  • Bug Fixes
    • Improved e2e resource cleanup to attempt full teardown and then report all delete errors together, instead of stopping at the first failure.

  - Resource interface with Create/Delete for consistent lifecycle management
  - Typed helpers: ClusterRole, ClusterRoleBinding, ServiceAccount, CRD,
    CustomResource, Namespace
  - ResourceCleanup for multi-cluster test teardown
  - E2E tests MTA-851–855 covering RBAC and CRD export scenarios

Signed-off-by: Ran Wurmbrand <rwurmbra@redhat.com>
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9db7fb73-d660-411e-b3bb-70cdd008259a

📥 Commits

Reviewing files that changed from the base of the PR and between 2eaebe7 and 2987fbc.

📒 Files selected for processing (7)
  • e2e-tests/framework/resources.go
  • e2e-tests/framework/test_helpers.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
🚧 Files skipped from review as they are similar to previous changes (6)
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/framework/test_helpers.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go

📝 Walkthrough

Walkthrough

Adds Kubernetes resource helpers and RBAC validation utilities for e2e tests, plus Widget CRD/CR testdata and five new migration scenarios covering namespace-only, RBAC, split-apply, dual-ClusterRole, and CRD/custom-resource export flows.

Changes

Cluster-level resource export e2e test suite

Layer / File(s) Summary
Resource wrappers and helpers
e2e-tests/framework/resources.go, e2e-tests/framework/test_helpers.go, e2e-tests/utils/utils.go
Defines the Resource interface and cleanup helper, adds kubectl-backed wrappers for ClusterRole, ClusterRoleBinding, ServiceAccount, CustomResourceDefinition, CustomResource, and Namespace, and adds RBAC validation plus file-existence helpers.
MTA-851, MTA-852, and MTA-853 tests
e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go, e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go, e2e-tests/tests/tier0/mta_853_split_apply_test.go
MTA-851 checks that a namespace-only export does not create _cluster output. MTA-852 creates RBAC resources, runs the Crane pipeline, applies output on the target, and validates the binding mapping. MTA-853 sets up non-admin contexts, creates cluster-scoped RBAC, checks denied cluster-scoped output, and applies namespace-scoped resources on the target.
MTA-854 and MTA-855 tests
e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go, e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go, e2e-tests/testdata/widget_cr.yaml, e2e-tests/testdata/widget_crd.yaml
MTA-854 creates two ClusterRoles and two ClusterRoleBindings on the source, runs export/transform/apply, applies the output on the target, and verifies both bindings reference the expected roles and service account. MTA-855 adds Widget CRD/CR testdata, creates the CRD and CR on the source, waits for CRD establishment, runs the Crane pipeline, applies output on the target, and verifies the Widget custom resource field value.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

kind/feature, test

Suggested reviewers

  • stillalearner
  • aufi
  • midays

Poem

🐇 I hop through clusters, neat and spry,
RBAC, CRDs, and exports fly.
A Widget blooms in blue today,
And _cluster stays out of the way.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds MTA-851–854 RBAC/export tests and helper refactors that are not covered by #579. Move the unrelated RBAC/export tests and helper refactors into a separate PR, or link the missing issues they satisfy.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the typed Kubernetes helpers and the added cluster-level export e2e tests.
Linked Issues check ✅ Passed The new MTA-855 test covers CRD and namespaced custom resource export as required by #579.

✏️ 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.

@github-actions

Copy link
Copy Markdown

Test Coverage Report

Total: 46.7%

Per-package coverage

  • github.com/konveyor/crane — 0.0%
  • github.com/konveyor/crane/cmd/apply — 52.7%
  • github.com/konveyor/crane/cmd/convert — 0.0%
  • github.com/konveyor/crane/cmd/export — 92.9%
  • github.com/konveyor/crane/cmd/plugin-manager — 0.0%
  • github.com/konveyor/crane/cmd/plugin-manager/add — 0.0%
  • github.com/konveyor/crane/cmd/plugin-manager/list — 0.0%
  • github.com/konveyor/crane/cmd/plugin-manager/remove — 0.0%
  • github.com/konveyor/crane/cmd/skopeo-sync-gen — 0.0%
  • github.com/konveyor/crane/cmd/transfer-pvc — 9.2%
  • github.com/konveyor/crane/cmd/transform — 59.7%
  • github.com/konveyor/crane/cmd/transform/listplugins — 23.0%
  • github.com/konveyor/crane/cmd/transform/optionals — 0.0%
  • github.com/konveyor/crane/cmd/tunnel-api — 0.0%
  • github.com/konveyor/crane/cmd/validate — 62.7%
  • github.com/konveyor/crane/cmd/version — 20.0%
  • github.com/konveyor/crane/internal/apply — 33.8%
  • github.com/konveyor/crane/internal/buildinfo — 100.0%
  • github.com/konveyor/crane/internal/file — 79.0%
  • github.com/konveyor/crane/internal/flags — 0.0%
  • github.com/konveyor/crane/internal/kustomize — 85.7%
  • github.com/konveyor/crane/internal/plugin — 32.9%
  • github.com/konveyor/crane/internal/transform — 80.9%
  • github.com/konveyor/crane/internal/validate — 58.6%
Full function-level details
github.com/konveyor/crane/cmd/apply/apply.go:44:			Complete					100.0%
github.com/konveyor/crane/cmd/apply/apply.go:50:			Validate					87.5%
github.com/konveyor/crane/cmd/apply/apply.go:64:			Run						0.0%
github.com/konveyor/crane/cmd/apply/apply.go:68:			NewApplyCommand					0.0%
github.com/konveyor/crane/cmd/apply/apply.go:109:			getStageNames					100.0%
github.com/konveyor/crane/cmd/apply/apply.go:117:			addFlagsForOptions				0.0%
github.com/konveyor/crane/cmd/apply/apply.go:133:			run						81.4%
github.com/konveyor/crane/cmd/convert/convert.go:30:			NewConvertOptions				0.0%
github.com/konveyor/crane/cmd/convert/convert.go:63:			addFlagsForConvertOptions			0.0%
github.com/konveyor/crane/cmd/convert/convert.go:74:			Complete					0.0%
github.com/konveyor/crane/cmd/convert/convert.go:83:			Run						0.0%
github.com/konveyor/crane/cmd/convert/convert.go:87:			run						0.0%
github.com/konveyor/crane/cmd/convert/convert.go:112:			getClientFromContext				0.0%
github.com/konveyor/crane/cmd/convert/convert.go:134:			getRestConfigFromContext			0.0%
github.com/konveyor/crane/cmd/export/cluster.go:29:			NewClusterScopeHandler				100.0%
github.com/konveyor/crane/cmd/export/cluster.go:35:			isClusterScopedResource				100.0%
github.com/konveyor/crane/cmd/export/cluster.go:44:			filterRbacResources				100.0%
github.com/konveyor/crane/cmd/export/cluster.go:102:			NewClusterScopedRbacHandler			100.0%
github.com/konveyor/crane/cmd/export/cluster.go:113:			exportedSANamespaces				100.0%
github.com/konveyor/crane/cmd/export/cluster.go:126:			groupMatchesExportedSANamespaces		100.0%
github.com/konveyor/crane/cmd/export/cluster.go:143:			parseServiceAccountUserSubject			100.0%
github.com/konveyor/crane/cmd/export/cluster.go:154:			prepareForFiltering				100.0%
github.com/konveyor/crane/cmd/export/cluster.go:187:			filteredResourcesOfKind				100.0%
github.com/konveyor/crane/cmd/export/cluster.go:213:			accept						100.0%
github.com/konveyor/crane/cmd/export/cluster.go:223:			acceptClusterRoleBinding			100.0%
github.com/konveyor/crane/cmd/export/cluster.go:260:			acceptClusterRole				100.0%
github.com/konveyor/crane/cmd/export/cluster.go:284:			acceptSecurityContextConstraints		100.0%
github.com/konveyor/crane/cmd/export/cluster.go:336:			anyServiceAccountInNamespace			100.0%
github.com/konveyor/crane/cmd/export/crd.go:17:				normalizeGroupSet				85.7%
github.com/konveyor/crane/cmd/export/crd.go:29:				shouldSkipCRDGroup				100.0%
github.com/konveyor/crane/cmd/export/crd.go:50:				crdFailureAPIResourceName			100.0%
github.com/konveyor/crane/cmd/export/crd.go:56:				getOperatorManager				92.9%
github.com/konveyor/crane/cmd/export/crd.go:88:				collectRelatedCRDs				90.6%
github.com/konveyor/crane/cmd/export/discover.go:40:			hasClusterScopedManifests			100.0%
github.com/konveyor/crane/cmd/export/discover.go:58:			prepareClusterResourceDir			100.0%
github.com/konveyor/crane/cmd/export/discover.go:74:			prepareFailuresDir				100.0%
github.com/konveyor/crane/cmd/export/discover.go:86:			writeResources					85.7%
github.com/konveyor/crane/cmd/export/discover.go:134:			writeErrors					83.3%
github.com/konveyor/crane/cmd/export/discover.go:176:			getFilePath					95.2%
github.com/konveyor/crane/cmd/export/discover.go:214:			discoverPreferredResources			100.0%
github.com/konveyor/crane/cmd/export/discover.go:243:			resourceToExtract				100.0%
github.com/konveyor/crane/cmd/export/discover.go:312:			isAdmittedResource				100.0%
github.com/konveyor/crane/cmd/export/discover.go:321:			getObjects					100.0%
github.com/konveyor/crane/cmd/export/discover.go:355:			iterateItemsByGet				93.8%
github.com/konveyor/crane/cmd/export/discover.go:381:			iterateItemsInList				92.3%
github.com/konveyor/crane/cmd/export/export.go:53:			Complete					90.0%
github.com/konveyor/crane/cmd/export/export.go:92:			Validate					100.0%
github.com/konveyor/crane/cmd/export/export.go:133:			validateExportNamespace				87.5%
github.com/konveyor/crane/cmd/export/export.go:150:			allResourceListsForbidden			87.5%
github.com/konveyor/crane/cmd/export/export.go:168:			Run						0.0%
github.com/konveyor/crane/cmd/export/export.go:281:			NewExportCommand				54.2%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:43:		Complete					0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:48:		Validate					0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:91:		Run						0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:95:		NewAddCommand					0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:127:		addFlagsForOptions				0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:132:		run						0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:204:		downloadBinary					0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:253:		binaryURIForPlatform				0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:46:		Complete					0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:51:		Validate					0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:56:		Run						0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:60:		NewListCommand					0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:90:		addFlagsForOptions				0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:98:		run						0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:167:		printInstalledInformation			0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:177:		groupInformationForPlugins			0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:196:		printInformation				0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:208:		printParamsInformation				0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:222:		getOptionalFields				0.0%
github.com/konveyor/crane/cmd/plugin-manager/list/list.go:247:		printTable					0.0%
github.com/konveyor/crane/cmd/plugin-manager/plugin-manager.go:33:	Complete					0.0%
github.com/konveyor/crane/cmd/plugin-manager/plugin-manager.go:38:	Validate					0.0%
github.com/konveyor/crane/cmd/plugin-manager/plugin-manager.go:43:	Run						0.0%
github.com/konveyor/crane/cmd/plugin-manager/plugin-manager.go:47:	NewPluginManagerCommand				0.0%
github.com/konveyor/crane/cmd/plugin-manager/plugin-manager.go:78:	addFlagsForOptions				0.0%
github.com/konveyor/crane/cmd/plugin-manager/plugin-manager.go:86:	run						0.0%
github.com/konveyor/crane/cmd/plugin-manager/remove/remove.go:33:	Complete					0.0%
github.com/konveyor/crane/cmd/plugin-manager/remove/remove.go:38:	Validate					0.0%
github.com/konveyor/crane/cmd/plugin-manager/remove/remove.go:43:	Run						0.0%
github.com/konveyor/crane/cmd/plugin-manager/remove/remove.go:47:	NewRemoveCommand				0.0%
github.com/konveyor/crane/cmd/plugin-manager/remove/remove.go:77:	run						0.0%
github.com/konveyor/crane/cmd/skopeo-sync-gen/skopeo-sync-gen.go:61:	Complete					0.0%
github.com/konveyor/crane/cmd/skopeo-sync-gen/skopeo-sync-gen.go:65:	Validate					0.0%
github.com/konveyor/crane/cmd/skopeo-sync-gen/skopeo-sync-gen.go:69:	NewSkopeoSyncGenCommand				0.0%
github.com/konveyor/crane/cmd/skopeo-sync-gen/skopeo-sync-gen.go:103:	shouldAddImageStream				0.0%
github.com/konveyor/crane/cmd/skopeo-sync-gen/skopeo-sync-gen.go:114:	Run						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:37:		NewRsyncLogStream				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:50:		Init						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:138:		writeProgressToFile				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:148:		Close						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:154:		Streams						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:190:		addDataSize					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:215:		String						100.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:219:		MarshalJSON					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:223:		AsString					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:271:		NewProgress					100.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:291:		Completed					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:296:		Status						38.5%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:321:		Merge						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:376:		newDataSize					72.7%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:399:		parseRsyncLogs					76.1%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:479:		waitForPodRunning				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/progress.go:513:		getFinalPodStatus				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:89:		Validate					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:117:		Validate					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:133:		NewTransferPVCCommand				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:169:		addFlagsToTransferPVCCommand			0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:189:		Complete					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:220:		Validate					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:246:		Run						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:250:		getClientFromContext				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:271:		getRestConfigFromContext			0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:278:		run						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:485:		getValidatedResourceName			0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:495:		getNodeNameForPVC				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:515:		getIDsForNamespace				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:541:		getRsyncClientPodSecurityContext		0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:553:		getRsyncServerPodSecurityContext		0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:565:		garbageCollect					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:602:		deleteResourcesIteratively			0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:628:		deleteResourcesForGVK				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:649:		followClientLogs				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:678:		waitForEndpoint					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:690:		createEndpoint					0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:735:		getRouteHostName				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:752:		buildDestinationPVC				0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:773:		ApplyTo						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:793:		ApplyTo						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:805:		ApplyTo						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:821:		String						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:825:		Set						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:835:		Type						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:841:		parseSourceDestinationMapping			100.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:863:		String						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:867:		Set						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:876:		Type						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:880:		String						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:884:		Set						0.0%
github.com/konveyor/crane/cmd/transfer-pvc/transfer-pvc.go:894:		Type						0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:33:	Complete					0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:38:	Validate					0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:43:	Run						0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:47:	NewListPluginsCommand				0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:80:	GetPluginNames					85.7%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:95:	getFilteredPlugins				75.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:104:	run						0.0%
github.com/konveyor/crane/cmd/transform/optionals/optionals.go:31:	Complete					0.0%
github.com/konveyor/crane/cmd/transform/optionals/optionals.go:36:	Validate					0.0%
github.com/konveyor/crane/cmd/transform/optionals/optionals.go:41:	Run						0.0%
github.com/konveyor/crane/cmd/transform/optionals/optionals.go:45:	NewOptionalsCommand				0.0%
github.com/konveyor/crane/cmd/transform/optionals/optionals.go:78:	run						0.0%
github.com/konveyor/crane/cmd/transform/transform.go:56:		Complete					0.0%
github.com/konveyor/crane/cmd/transform/transform.go:62:		Validate					83.3%
github.com/konveyor/crane/cmd/transform/transform.go:81:		Run						0.0%
github.com/konveyor/crane/cmd/transform/transform.go:86:		getPluginCompletions				100.0%
github.com/konveyor/crane/cmd/transform/transform.go:111:		NewTransformCommand				0.0%
github.com/konveyor/crane/cmd/transform/transform.go:154:		addFlagsForOptions				0.0%
github.com/konveyor/crane/cmd/transform/transform.go:176:		run						11.8%
github.com/konveyor/crane/cmd/transform/transform.go:327:		optionalFlagsToLower				100.0%
github.com/konveyor/crane/cmd/transform/transform.go:337:		runStageWithCleanup				0.0%
github.com/konveyor/crane/cmd/transform/transform.go:353:		reconcileInstructionStages			81.0%
github.com/konveyor/crane/cmd/transform/transform.go:396:		ensurePreviousStagesRun				83.3%
github.com/konveyor/crane/cmd/transform/transform.go:413:		ensureStagesHaveOutput				92.9%
github.com/konveyor/crane/cmd/transform/transform.go:452:		createDefaultStagesForAllPlugins		94.7%
github.com/konveyor/crane/cmd/transform/transform.go:504:		validateStageNameToken				100.0%
github.com/konveyor/crane/cmd/transform/transform.go:519:		findStageByDirName				100.0%
github.com/konveyor/crane/cmd/transform/transform.go:531:		findStagesByName				100.0%
github.com/konveyor/crane/cmd/transform/transform.go:543:		createStageDirectory				77.8%
github.com/konveyor/crane/cmd/transform/transform.go:564:		createCustomStageWithExplicitName		100.0%
github.com/konveyor/crane/cmd/transform/transform.go:580:		createCustomStageWithAutoPriority		71.4%
github.com/konveyor/crane/cmd/transform/transform.go:602:		createPluginStage				0.0%
github.com/konveyor/crane/cmd/transform/transform.go:635:		resolveAndValidateStages			58.5%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:35:		NewTunnelAPIOptions				0.0%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:65:		addFlagsForTunnelAPIOptions			0.0%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:77:		Complete					0.0%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:100:		Validate					0.0%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:116:		Run						0.0%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:120:		getClientFromContext				0.0%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:129:		getRestConfigFromContext			0.0%
github.com/konveyor/crane/cmd/tunnel-api/tunnel-api.go:136:		run						0.0%
github.com/konveyor/crane/cmd/validate/validate.go:37:			Complete					83.3%
github.com/konveyor/crane/cmd/validate/validate.go:49:			Validate					100.0%
github.com/konveyor/crane/cmd/validate/validate.go:91:			Run						17.5%
github.com/konveyor/crane/cmd/validate/validate.go:194:			NewValidateCommand				50.0%
github.com/konveyor/crane/cmd/version/version.go:20:			Complete					0.0%
github.com/konveyor/crane/cmd/version/version.go:25:			Validate					0.0%
github.com/konveyor/crane/cmd/version/version.go:30:			Run						0.0%
github.com/konveyor/crane/cmd/version/version.go:34:			NewVersionCommand				0.0%
github.com/konveyor/crane/cmd/version/version.go:60:			run						100.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:21:			CreateTempDir					100.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:28:			ListFilesRecursively				91.7%
github.com/konveyor/crane/e2e-tests/utils/utils.go:51:			ListFilesRecursivelyAsList			80.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:75:			HasFilesRecursively				80.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:86:			ReadTestdataFile				88.9%
github.com/konveyor/crane/e2e-tests/utils/utils.go:105:			TestdataFilePath				0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:125:			GoldenManifestsDir				90.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:144:			CompareDirectoryFileSets			78.9%
github.com/konveyor/crane/e2e-tests/utils/utils.go:179:			CompareDirectoryYAMLSemantics			82.4%
github.com/konveyor/crane/e2e-tests/utils/utils.go:213:			CompareDirectoryYAMLSemanticsExport		89.3%
github.com/konveyor/crane/e2e-tests/utils/utils.go:265:			buildNormalizedExportIndex			81.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:305:			canonicalizeDocs				87.5%
github.com/konveyor/crane/e2e-tests/utils/utils.go:319:			extractResourceIdentity				77.8%
github.com/konveyor/crane/e2e-tests/utils/utils.go:382:			parseYAMLDocuments				100.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:401:			compareYAMLFileBytes				100.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:421:			AssertNoKindsInOutput				0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:477:			AssertKindsInOutput				0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:529:			LooksLikeYAMLFile				100.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:543:			normalizeUnstableFields				100.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:580:			normalizePodServiceAccountVolumeNames		90.9%
github.com/konveyor/crane/e2e-tests/utils/utils.go:639:			normalizeWithPath				92.9%
github.com/konveyor/crane/e2e-tests/utils/utils.go:669:			shouldDropField					100.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:720:			AssertWhiteoutResourceFilesExist		0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:760:			AssertWhiteoutResourceFileCount			0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:792:			AssertWhiteoutCommentsInKustomization		0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:847:			AssertKindsNotInActiveKustomizeResources	0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:889:			CaptureAPISurfaceScriptPath			75.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:908:			ToInt64						0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:925:			ExtractCPUAverageUtilization			0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:958:			AssertFilesExist				0.0%
github.com/konveyor/crane/internal/apply/kustomize.go:31:		ApplySingleStage				0.0%
github.com/konveyor/crane/internal/apply/kustomize.go:80:		ApplyMultiStage					0.0%
github.com/konveyor/crane/internal/apply/kustomize.go:134:		runKustomizeBuild				0.0%
github.com/konveyor/crane/internal/apply/kustomize.go:143:		filterClusterScopedResources			82.4%
github.com/konveyor/crane/internal/apply/kustomize.go:199:		splitMultiDocYAMLToFiles			86.7%
github.com/konveyor/crane/internal/buildinfo/buildinfo.go:25:		readKustomizeVersion				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:22:		ReadFiles					100.0%
github.com/konveyor/crane/internal/file/file_helper.go:32:		readFiles					84.0%
github.com/konveyor/crane/internal/file/file_helper.go:91:		GetWhiteOutFilePath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:95:		GetTransformPath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:99:		GetIgnoredPatchesPath				0.0%
github.com/konveyor/crane/internal/file/file_helper.go:103:		updateTransformDirPath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:107:		updateIgnoredPatchesDirPath			0.0%
github.com/konveyor/crane/internal/file/file_helper.go:114:		updatePath					100.0%
github.com/konveyor/crane/internal/file/file_helper.go:121:		GetOutputFilePath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:131:		GetStageDir					100.0%
github.com/konveyor/crane/internal/file/file_helper.go:137:		GetInputDir					100.0%
github.com/konveyor/crane/internal/file/file_helper.go:143:		GetPatchesDir					100.0%
github.com/konveyor/crane/internal/file/file_helper.go:149:		GetKustomizationPath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:155:		GetMetadataPath					100.0%
github.com/konveyor/crane/internal/file/file_helper.go:161:		GetResourceTypeFilePath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:167:		GetPatchFilePath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:174:		GetStageTransformDir				0.0%
github.com/konveyor/crane/internal/file/file_helper.go:180:		GetStageOutputDir				0.0%
github.com/konveyor/crane/internal/file/file_helper.go:187:		GetResourceFilename				75.0%
github.com/konveyor/crane/internal/file/ordering.go:82:			GetResourceOrder				100.0%
github.com/konveyor/crane/internal/file/ordering.go:92:			GetOrderedResourceFilename			100.0%
github.com/konveyor/crane/internal/flags/global_flags.go:14:		ApplyFlags					0.0%
github.com/konveyor/crane/internal/flags/global_flags.go:21:		GetLogger					0.0%
github.com/konveyor/crane/internal/flags/global_flags.go:29:		initConfig					0.0%
github.com/konveyor/crane/internal/flags/help_groups.go:12:		KubernetesClientInheritedFlagNames		0.0%
github.com/konveyor/crane/internal/flags/help_groups.go:40:		SetGroupedHelp					0.0%
github.com/konveyor/crane/internal/kustomize/args.go:20:		ParseAndValidateArgs				100.0%
github.com/konveyor/crane/internal/kustomize/args.go:92:		splitArgs					100.0%
github.com/konveyor/crane/internal/kustomize/runner.go:21:		Build						82.4%
github.com/konveyor/crane/internal/kustomize/runner.go:55:		buildOptions					100.0%
github.com/konveyor/crane/internal/kustomize/runner.go:105:		setEnvVars					46.2%
github.com/konveyor/crane/internal/plugin/plugin_helper.go:21:		GetPlugins					0.0%
github.com/konveyor/crane/internal/plugin/plugin_helper.go:38:		getBinaryPlugins				0.0%
github.com/konveyor/crane/internal/plugin/plugin_helper.go:63:		IsExecAny					0.0%
github.com/konveyor/crane/internal/plugin/plugin_helper.go:67:		GetFilteredPlugins				0.0%
github.com/konveyor/crane/internal/plugin/plugin_helper.go:109:		isPluginInList					0.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:24:	BuildManifestMap				0.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:68:	GetYamlFromUrl					75.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:82:	YamlToManifest					72.7%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:104:	FilterPluginForOsArch				100.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:119:	GetDefaultSource				0.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:128:	LocateBinaryInPluginDir				0.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:140:	IsUrl						100.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:146:	getData						80.0%
github.com/konveyor/crane/internal/transform/instructions.go:31:	LoadInstructions				61.1%
github.com/konveyor/crane/internal/transform/instructions.go:63:	friendlyInstructionsDecodeError			87.5%
github.com/konveyor/crane/internal/transform/instructions.go:78:	ValidateInstructions				100.0%
github.com/konveyor/crane/internal/transform/instructions.go:112:	GenerateStageDirNames				100.0%
github.com/konveyor/crane/internal/transform/orchestrator.go:41:	RunMultiStage					75.6%
github.com/konveyor/crane/internal/transform/orchestrator.go:142:	executeStage					72.7%
github.com/konveyor/crane/internal/transform/orchestrator.go:194:	transformResources				68.4%
github.com/konveyor/crane/internal/transform/orchestrator.go:245:	formatResourceID				0.0%
github.com/konveyor/crane/internal/transform/orchestrator.go:252:	getPluginForStage				90.9%
github.com/konveyor/crane/internal/transform/orchestrator.go:279:	getAvailablePluginNames				0.0%
github.com/konveyor/crane/internal/transform/orchestrator.go:292:	applyStageTransforms				82.1%
github.com/konveyor/crane/internal/transform/orchestrator.go:359:	loadResourcesFromDirectory			85.7%
github.com/konveyor/crane/internal/transform/orchestrator.go:374:	writeResourcesToDirectory			73.1%
github.com/konveyor/crane/internal/transform/stages.go:22:		DiscoverStages					90.5%
github.com/konveyor/crane/internal/transform/stages.go:83:		FilterStages					100.0%
github.com/konveyor/crane/internal/transform/stages.go:112:		GetFirstStage					100.0%
github.com/konveyor/crane/internal/transform/stages.go:122:		GetLastStage					66.7%
github.com/konveyor/crane/internal/transform/stages.go:132:		GetPreviousStage				100.0%
github.com/konveyor/crane/internal/transform/stages.go:142:		GetNextStage					100.0%
github.com/konveyor/crane/internal/transform/stages.go:152:		ValidateStageName				100.0%
github.com/konveyor/crane/internal/transform/stages.go:161:		GenerateStageName				100.0%
github.com/konveyor/crane/internal/transform/test_helpers.go:8:		hasKustomizeCommand				100.0%
github.com/konveyor/crane/internal/transform/test_helpers.go:14:	contains					100.0%
github.com/konveyor/crane/internal/transform/test_helpers.go:23:	findInString					100.0%
github.com/konveyor/crane/internal/transform/writer.go:28:		NewKustomizeWriter				100.0%
github.com/konveyor/crane/internal/transform/writer.go:37:		WriteStage					68.4%
github.com/konveyor/crane/internal/transform/writer.go:218:		getResourceID					100.0%
github.com/konveyor/crane/internal/transform/writer.go:231:		filterValidRemoveOps				76.2%
github.com/konveyor/crane/internal/transform/writer.go:275:		pathExists					93.5%
github.com/konveyor/crane/internal/transform/writer.go:352:		generateKustomizationWithComments		93.8%
github.com/konveyor/crane/internal/transform/writer.go:383:		checkStageDirectory				23.1%
github.com/konveyor/crane/internal/validate/api_resources.go:24:	ParseAPIResourcesJSON				89.7%
github.com/konveyor/crane/internal/validate/matcher.go:25:		MatchResults					75.0%
github.com/konveyor/crane/internal/validate/matcher.go:36:		MatchResultsFromIndex				100.0%
github.com/konveyor/crane/internal/validate/matcher.go:76:		buildDiscoveryIndex				71.4%
github.com/konveyor/crane/internal/validate/matcher.go:110:		matchEntry					100.0%
github.com/konveyor/crane/internal/validate/matcher.go:139:		buildKindIndex					100.0%
github.com/konveyor/crane/internal/validate/matcher.go:151:		addSuggestion					92.3%
github.com/konveyor/crane/internal/validate/report.go:17:		FormatTable					91.3%
github.com/konveyor/crane/internal/validate/report.go:60:		FormatJSON					100.0%
github.com/konveyor/crane/internal/validate/report.go:67:		FormatYAML					0.0%
github.com/konveyor/crane/internal/validate/report.go:79:		WriteFailures					0.0%
github.com/konveyor/crane/internal/validate/report.go:115:		failureFileName					0.0%
github.com/konveyor/crane/internal/validate/report.go:129:		safeFilePart					0.0%
github.com/konveyor/crane/internal/validate/report.go:145:		parseAPIVersion					0.0%
github.com/konveyor/crane/internal/validate/scanner.go:34:		ScanManifests					76.5%
github.com/konveyor/crane/internal/validate/types.go:46:		HasIncompatible					100.0%
github.com/konveyor/crane/internal/validate/types.go:49:		IncompatibleResults				0.0%
github.com/konveyor/crane/main.go:21:					main						0.0%
total:									(statements)					46.7%

Posted by CI

@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: 11

🤖 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 `@e2e-tests/framework/test_helpers.go`:
- Around line 74-80: The subject check in the helper that uses kubectl.Run and
compares against b.SubjectName is too strict because
jsonpath={.subjects[*].name} can return multiple space-separated names. Update
the comparison logic in the cluster role binding verification helper to treat
the output as a list and verify that b.SubjectName is present, rather than
requiring exact string equality. Keep the existing error handling and adjust the
check around the subject comparison so it remains robust if a binding has
multiple subjects.

In `@e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go`:
- Around line 37-39: The cleanup wrapper currently ignores the error returned by
CleanupScenario, which triggers errcheck in CI. Update the DeferCleanup callback
to capture and handle the CleanupScenario return value in the
mta_851_no_cluster_resources_test.go test, using the existing CleanupScenario
call with paths.TempDir, srcApp, and tgtApp so the error is not silently
dropped.

In `@e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go`:
- Around line 45-48: Handle the ignored error from CleanupScenario in the
DeferCleanup block to satisfy errcheck. Update the cleanup closure in the test
to capture and handle the return value from CleanupScenario alongside the
ResourceCleanup call, using the same cleanup symbols (DeferCleanup,
ResourceCleanup, CleanupScenario) so the failure is not dropped and CI no longer
flags the unchecked error.

In `@e2e-tests/tests/tier0/mta_853_split_apply_test.go`:
- Around line 48-55: Move the `Expect(err).NotTo(HaveOccurred())` check to
immediately follow `NewScenarioPaths("crane-na1-*")` in
`mta_853_split_apply_test.go` before `paths` is used to build `ExportOptions`,
`TransformOptions`, and `ApplyOptions`; this keeps `paths` from being
dereferenced after a failed `NewScenarioPaths` call and aligns the pattern with
the related MTA-851/852 tests.
- Around line 65-69: Handle the ignored error from CleanupScenario inside the
DeferCleanup callback to satisfy errcheck and avoid CI failures. In the
DeferCleanup function in mta_853_split_apply_test.go, capture and handle the
return value from CleanupScenario after ResourceCleanup, using the existing
cleanup variables like paths.TempDir, srcAppNonAdmin, and tgtAppNonAdmin, and
make sure any failure is surfaced or explicitly handled instead of being
dropped.
- Around line 9-11: The test file has a duplicate Gomega import causing
staticcheck ST1019. In the import block for mta_853_split_apply_test.go, remove
the named github.com/onsi/gomega import and keep the dot import already used
alongside ginkgo. Then ensure the assertions in the test body use Succeed()
directly via the existing dot import, including the check near the referenced
expectation in the test.
- Around line 87-88: The export verification is checking the wrong relative path
and the assertion is inverted, so it can pass without confirming the failed
export. Update the `AssertFilesExist` call in the `mta_853_split_apply_test.go`
check to use the namespace-specific `failures/<namespace>/` location for
`deniedResources`, and change the expectation so the helper is asserted to
succeed rather than expecting an error.

In `@e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go`:
- Around line 53-55: The deferred teardown in the test ignores the error
returned by CleanupScenario, which can hide cleanup failures. Update the
DeferCleanup callback in the two-clusterroles test to capture and handle the
CleanupScenario return value from the srcApp/tgtApp teardown path, using the
existing paths.TempDir context and reporting any error so teardown failures are
visible.

In `@e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go`:
- Around line 44-49: The CustomResource setup in the tier1 MTA CRD test is
missing the Resource field, which causes cleanup to fail when ResourceCleanup
calls CustomResource.Delete. Update the cr initialization so the Widget custom
resource includes the correct API resource name via the Resource field,
alongside Name, Namespace, Kind, and YAML. Use the CustomResource and
ResourceCleanup symbols in this test to locate the setup that must be fixed.
- Around line 55-58: The DeferCleanup block in
mta_855_crd_custom_resource_test.go ignores the return value from
CleanupScenario, triggering errcheck. Update the cleanup closure to capture and
assert the CleanupScenario result with Gomega (similar to how other cleanup
failures are surfaced), while keeping ResourceCleanup and the existing cleanup
flow in place. Use the CleanupScenario call inside DeferCleanup as the target to
fix so the failure is reported instead of dropped.

In `@e2e-tests/utils/utils.go`:
- Around line 958-979: `AssertFilesExist` is comparing the returned recursive
paths from `ListFilesRecursivelyAsList` against bare expected names, so it
misses files written under the namespace-specific failures directory. Update the
matching logic in `AssertFilesExist` to compare against `filepath.Base` (or
otherwise normalize both sides to the actual failure filenames) and ensure the
caller path is the failures dir used by export, so the check targets the real
files produced by the export flow.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: c1d49c35-d809-40b8-94dd-e06dfb5e001f

📥 Commits

Reviewing files that changed from the base of the PR and between 9fdeaae and 0a94748.

📒 Files selected for processing (10)
  • e2e-tests/framework/resources.go
  • e2e-tests/framework/test_helpers.go
  • e2e-tests/testdata/widget_cr.yaml
  • e2e-tests/testdata/widget_crd.yaml
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
  • e2e-tests/utils/utils.go

Comment thread e2e-tests/framework/test_helpers.go Outdated
Comment thread e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
Comment thread e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
Comment thread e2e-tests/tests/tier0/mta_853_split_apply_test.go
Comment thread e2e-tests/tests/tier0/mta_853_split_apply_test.go Outdated
Comment thread e2e-tests/tests/tier0/mta_853_split_apply_test.go Outdated
Comment thread e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
Comment thread e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
Comment thread e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
Comment thread e2e-tests/utils/utils.go

@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: 1

🤖 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 `@e2e-tests/framework/resources.go`:
- Around line 14-19: ResourceCleanup is aborting on the first Delete failure,
which leaves later resources and clusters uncleared. Update ResourceCleanup to
keep iterating through all clusters and resources, collect every error instead
of returning immediately, and then return a single aggregated error at the end.
Include cluster and resource context from ResourceCleanup, KubectlRunner, and
Resource.Delete in each failure so callers of DeferCleanup still get useful
cleanup diagnostics.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 548682d1-834d-4494-a333-2015fdaff30a

📥 Commits

Reviewing files that changed from the base of the PR and between 0a94748 and 2eaebe7.

📒 Files selected for processing (7)
  • e2e-tests/framework/resources.go
  • e2e-tests/framework/test_helpers.go
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
✅ Files skipped from review due to trivial changes (1)
  • e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • e2e-tests/tests/tier0/mta_851_no_cluster_resources_test.go
  • e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
  • e2e-tests/tests/tier1/mta_855_crd_custom_resource_test.go
  • e2e-tests/framework/test_helpers.go
  • e2e-tests/tests/tier0/mta_853_split_apply_test.go

Comment thread e2e-tests/framework/resources.go
Signed-off-by: Ran Wurmbrand <rwurmbra@redhat.com>
@RanWurmbrand RanWurmbrand force-pushed the infra/resources-and-tests branch from 2eaebe7 to 0335919 Compare June 24, 2026 16:23
Comment thread e2e-tests/tests/tier1/mta_854_two_clusterroles_test.go Outdated
Comment thread e2e-tests/tests/tier0/mta_852_minimal_rbac_test.go
@RanWurmbrand RanWurmbrand self-assigned this Jun 25, 2026
Signed-off-by: Ran Wurmbrand <rwurmbra@redhat.com>

@stillalearner stillalearner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@RanWurmbrand RanWurmbrand merged commit 9ffb27b into migtools:main Jun 29, 2026
5 checks passed
msajidmansoori12 pushed a commit to msajidmansoori12/crane that referenced this pull request Jul 1, 2026
…A-851–855) (migtools#576)

* Add typed K8s resource helpers and cluster-level export tests

  - Resource interface with Create/Delete for consistent lifecycle management
  - Typed helpers: ClusterRole, ClusterRoleBinding, ServiceAccount, CRD,
    CustomResource, Namespace
  - ResourceCleanup for multi-cluster test teardown
  - E2E tests MTA-851–855 covering RBAC and CRD export scenarios

Signed-off-by: Ran Wurmbrand <rwurmbra@redhat.com>

* addresed code rabbit

Signed-off-by: Ran Wurmbrand <rwurmbra@redhat.com>

* addressed comments

Signed-off-by: Ran Wurmbrand <rwurmbra@redhat.com>

---------

Signed-off-by: Ran Wurmbrand <rwurmbra@redhat.com>
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.

Test and Automate: CRD + namespaced custom resource (CA-9) Test and Automate: Two ClusterRoles, one Deployment (CA-3)

2 participants