Skip to content

Add non-admin ConfigMap migration test [MTC-291] and harden RBAC identity resolution#234

Merged
midays merged 9 commits intomigtools:mainfrom
msajidmansoori12:mtc_291
Apr 12, 2026
Merged

Add non-admin ConfigMap migration test [MTC-291] and harden RBAC identity resolution#234
midays merged 9 commits intomigtools:mainfrom
msajidmansoori12:mtc_291

Conversation

@msajidmansoori12
Copy link
Copy Markdown
Contributor

@msajidmansoori12 msajidmansoori12 commented Apr 7, 2026

Summary by CodeRabbit

  • Tests

    • Added comprehensive test for ConfigMap migration using non-admin users, validating data preservation throughout the migration process and proper resource creation on target clusters.
  • Infrastructure

    • Enhanced kubeconfig credential management and user identity resolution to improve support for non-admin users in migration scenarios.

…nch page as succeeded check

Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
… name same as context name

Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds a new end-to-end test for ConfigMap migration by non-admin users (MTC-291), updates the minikube user creation script to derive Kubernetes context credentials from context names instead of user names, and enhances the client framework to extract RBAC usernames from x509 client certificates.

Changes

Cohort / File(s) Summary
ConfigMap Migration E2E Test
e2e-tests/tests/mtc_291_configmap_test.go
New tier0 test suite validating ConfigMap migration with non-admin user permissions, verifying rendered manifests contain expected data and validating post-apply state on target cluster.
Minikube User Creation Script
hack/minikube-create-user.sh
Updated kubeconfig credential naming to use context name instead of user name for both set-credentials and set-context operations; updated documentation comments to reflect user=<context> convention.
Client Framework Enhancement
e2e-tests/framework/client.go
Enhanced ResolveUsernameForContext to derive RBAC username from x509 client certificate CommonName by parsing ClientCertificateData or ClientCertificate files (supporting PEM and DER formats); falls back to ctx.AuthInfo when no client certificate is configured; added parseClientCertificate helper function.

Sequence Diagram

sequenceDiagram
    participant Test as Test Runner
    participant SourceCluster as Source Cluster
    participant Crane as Crane Pipeline
    participant TargetCluster as Target Cluster

    Test->>SourceCluster: Setup namespace-admin for non-admin user
    Test->>SourceCluster: Prepare source app
    Test->>Crane: Run export (source non-admin)
    Crane->>SourceCluster: Export ConfigMap as non-admin
    Test->>Crane: Run transform
    Crane->>Crane: Render manifests to temp directory
    Test->>Test: Validate ConfigMap YAML exists
    Test->>TargetCluster: Apply rendered manifests (non-admin)
    Test->>TargetCluster: Wait for target app validation
    Test->>TargetCluster: Verify ConfigMap exists (non-admin kubectl)
    TargetCluster-->>Test: ConfigMap data confirmed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

kind/feature, test

Suggested reviewers

  • stillalearner
  • nachandr

Poem

🐰 A ConfigMap hops through the clusters today,
With non-admin perms leading the way,
Certificates parsed, usernames found,
Migration magic, secure and sound! 🔐✨

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately reflects the main changes: adding a non-admin ConfigMap migration test (MTC-291) and hardening RBAC identity resolution via kubeconfig/certificate parsing improvements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

Test Coverage Report

Total: 20.6%

Per-package coverage

  • github.com/konveyor/crane — 0.0%
  • github.com/konveyor/crane/cmd/apply — 0.0%
  • github.com/konveyor/crane/cmd/convert — 0.0%
  • github.com/konveyor/crane/cmd/export — 93.1%
  • 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/runfn — 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 — 0.0%
  • github.com/konveyor/crane/cmd/transform/listplugins — 0.0%
  • github.com/konveyor/crane/cmd/transform/optionals — 0.0%
  • github.com/konveyor/crane/cmd/tunnel-api — 0.0%
  • github.com/konveyor/crane/cmd/version — 0.0%
  • github.com/konveyor/crane/e2e-tests/framework — 0.0%
  • github.com/konveyor/crane/e2e-tests/utils — 0.0%
  • github.com/konveyor/crane/internal/file — 76.0%
  • github.com/konveyor/crane/internal/flags — 0.0%
  • github.com/konveyor/crane/internal/plugin — 32.9%
Full function-level details
github.com/konveyor/crane/cmd/apply/apply.go:36:			Complete				0.0%
github.com/konveyor/crane/cmd/apply/apply.go:41:			Validate				0.0%
github.com/konveyor/crane/cmd/apply/apply.go:46:			Run					0.0%
github.com/konveyor/crane/cmd/apply/apply.go:50:			NewApplyCommand				0.0%
github.com/konveyor/crane/cmd/apply/apply.go:82:			addFlagsForOptions			0.0%
github.com/konveyor/crane/cmd/apply/apply.go:88:			run					0.0%
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:58:				collectRelatedCRDs			89.7%
github.com/konveyor/crane/cmd/export/discover.go:39:			hasClusterScopedManifests		100.0%
github.com/konveyor/crane/cmd/export/discover.go:57:			prepareClusterResourceDir		100.0%
github.com/konveyor/crane/cmd/export/discover.go:73:			prepareFailuresDir			100.0%
github.com/konveyor/crane/cmd/export/discover.go:85:			writeResources				85.7%
github.com/konveyor/crane/cmd/export/discover.go:133:			writeErrors				83.3%
github.com/konveyor/crane/cmd/export/discover.go:174:			getFilePath				100.0%
github.com/konveyor/crane/cmd/export/discover.go:185:			discoverPreferredResources		100.0%
github.com/konveyor/crane/cmd/export/discover.go:214:			resourceToExtract			100.0%
github.com/konveyor/crane/cmd/export/discover.go:283:			isAdmittedResource			100.0%
github.com/konveyor/crane/cmd/export/discover.go:292:			getObjects				100.0%
github.com/konveyor/crane/cmd/export/discover.go:326:			iterateItemsByGet			93.8%
github.com/konveyor/crane/cmd/export/discover.go:352:			iterateItemsInList			92.3%
github.com/konveyor/crane/cmd/export/export.go:52:			Complete				90.0%
github.com/konveyor/crane/cmd/export/export.go:91:			Validate				100.0%
github.com/konveyor/crane/cmd/export/export.go:106:			validateExportNamespace			87.5%
github.com/konveyor/crane/cmd/export/export.go:122:			Run					0.0%
github.com/konveyor/crane/cmd/export/export.go:225:			NewExportCommand			50.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:42:		Complete				0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:47:		Validate				0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:90:		Run					0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:94:		NewAddCommand				0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:126:		addFlagsForOptions			0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:131:		run					0.0%
github.com/konveyor/crane/cmd/plugin-manager/add/add.go:195:		downloadBinary				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/runfn/runfn.go:33:			NewFnRunCommand				0.0%
github.com/konveyor/crane/cmd/runfn/runfn.go:49:			addFlagsForOptions			0.0%
github.com/konveyor/crane/cmd/runfn/runfn.go:59:			runE					0.0%
github.com/konveyor/crane/cmd/runfn/runfn.go:70:			preRunE					0.0%
github.com/konveyor/crane/cmd/runfn/runfn.go:112:			getFunctionImage			0.0%
github.com/konveyor/crane/cmd/runfn/runfn.go:124:			getContainerFunctions			0.0%
github.com/konveyor/crane/cmd/runfn/runfn.go:151:			getFunctionAnnotation			0.0%
github.com/konveyor/crane/cmd/runfn/runfn.go:170:			getFunctionConfig			0.0%
github.com/konveyor/crane/cmd/runfn/util.go:14:				WriteOutput				0.0%
github.com/konveyor/crane/cmd/runfn/util.go:31:				GetDestinationDir			0.0%
github.com/konveyor/crane/cmd/runfn/util.go:58:				ValidateFunctionImageURL		0.0%
github.com/konveyor/crane/cmd/runfn/util.go:80:				checkIfDirExists			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:31:	Complete				0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:36:	Validate				0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:41:	Run					0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:45:	NewListPluginsCommand			0.0%
github.com/konveyor/crane/cmd/transform/listplugins/listplugins.go:77:	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:77:	run					0.0%
github.com/konveyor/crane/cmd/transform/transform.go:43:		Complete				0.0%
github.com/konveyor/crane/cmd/transform/transform.go:48:		Validate				0.0%
github.com/konveyor/crane/cmd/transform/transform.go:53:		Run					0.0%
github.com/konveyor/crane/cmd/transform/transform.go:57:		NewTransformCommand			0.0%
github.com/konveyor/crane/cmd/transform/transform.go:91:		addFlagsForOptions			0.0%
github.com/konveyor/crane/cmd/transform/transform.go:105:		run					0.0%
github.com/konveyor/crane/cmd/transform/transform.go:237:		getPluginPrioritiesMap			0.0%
github.com/konveyor/crane/cmd/transform/transform.go:249:		optionalFlagsToLower			0.0%
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/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					0.0%
github.com/konveyor/crane/e2e-tests/framework/app.go:27:		Deploy					0.0%
github.com/konveyor/crane/e2e-tests/framework/app.go:49:		Validate				0.0%
github.com/konveyor/crane/e2e-tests/framework/app.go:71:		Cleanup					0.0%
github.com/konveyor/crane/e2e-tests/framework/app.go:93:		buildCommand				0.0%
github.com/konveyor/crane/e2e-tests/framework/app.go:100:		envWithBinDir				0.0%
github.com/konveyor/crane/e2e-tests/framework/app.go:116:		withExtraVars				0.0%
github.com/konveyor/crane/e2e-tests/framework/client.go:18:		ListPVCs				0.0%
github.com/konveyor/crane/e2e-tests/framework/client.go:41:		NewClientSetForContext			0.0%
github.com/konveyor/crane/e2e-tests/framework/client.go:63:		GetClusterNodeIP			0.0%
github.com/konveyor/crane/e2e-tests/framework/client.go:96:		ResolveUsernameForContext		0.0%
github.com/konveyor/crane/e2e-tests/framework/client.go:161:		parseClientCertificate			0.0%
github.com/konveyor/crane/e2e-tests/framework/crane.go:26:		Export					0.0%
github.com/konveyor/crane/e2e-tests/framework/crane.go:40:		Transform				0.0%
github.com/konveyor/crane/e2e-tests/framework/crane.go:54:		Apply					0.0%
github.com/konveyor/crane/e2e-tests/framework/crane.go:68:		TransferPVC				0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:19:		Run					0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:25:		RunWithStdin				0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:30:		executeWithStdin			0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:51:		normalizeKubectlArgs			0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:59:		CreateNamespace				0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:78:		ApplyDir				0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:94:		ApplyYAMLSpec				0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:103:		ValidateApplyDir			0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:119:		ScaleDeployment				0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:177:		ScaleDeploymentIfPresent		0.0%
github.com/konveyor/crane/e2e-tests/framework/kubectl.go:198:		CanI					0.0%
github.com/konveyor/crane/e2e-tests/framework/logging.go:11:		logVerboseCommand			0.0%
github.com/konveyor/crane/e2e-tests/framework/logging.go:19:		logVerboseOutput			0.0%
github.com/konveyor/crane/e2e-tests/framework/pipeline.go:11:		RunCranePipeline			0.0%
github.com/konveyor/crane/e2e-tests/framework/pipeline.go:25:		RunCranePipelineWithChecks		0.0%
github.com/konveyor/crane/e2e-tests/framework/pipeline.go:43:		PrepareSourceApp			0.0%
github.com/konveyor/crane/e2e-tests/framework/pipeline.go:57:		ApplyOutputToTarget			0.0%
github.com/konveyor/crane/e2e-tests/framework/pipeline.go:65:		ApplyOutputToTargetNonAdmin		0.0%
github.com/konveyor/crane/e2e-tests/framework/pipeline.go:69:		applyOutputManifests			0.0%
github.com/konveyor/crane/e2e-tests/framework/pipeline.go:80:		checkAndLogStageFiles			0.0%
github.com/konveyor/crane/e2e-tests/framework/rbac.go:14:		GrantNamespaceAdminToUser		0.0%
github.com/konveyor/crane/e2e-tests/framework/rbac.go:41:		RevokeNamespaceAdminFromUser		0.0%
github.com/konveyor/crane/e2e-tests/framework/rbac.go:56:		SetupNamespaceAdminUser			0.0%
github.com/konveyor/crane/e2e-tests/framework/rbac.go:115:		SetupNamespaceAdminUsersForScenario	0.0%
github.com/konveyor/crane/e2e-tests/framework/scenario.go:29:		NewMigrationScenario			0.0%
github.com/konveyor/crane/e2e-tests/framework/scenario.go:80:		NewScenarioPaths			0.0%
github.com/konveyor/crane/e2e-tests/framework/scenario.go:97:		CleanupScenario				0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:13:			CreateTempDir				0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:18:			ListFilesRecursively			0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:40:			ListFilesRecursivelyAsList		0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:64:			HasFilesRecursively			0.0%
github.com/konveyor/crane/e2e-tests/utils/utils.go:74:			ReadTestdataFile			0.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:83:		GetWhiteOutFilePath			100.0%
github.com/konveyor/crane/internal/file/file_helper.go:87:		GetTransformPath			100.0%
github.com/konveyor/crane/internal/file/file_helper.go:91:		GetIgnoredPatchesPath			0.0%
github.com/konveyor/crane/internal/file/file_helper.go:95:		updateTransformDirPath			100.0%
github.com/konveyor/crane/internal/file/file_helper.go:99:		updateIgnoredPatchesDirPath		0.0%
github.com/konveyor/crane/internal/file/file_helper.go:106:		updatePath				100.0%
github.com/konveyor/crane/internal/file/file_helper.go:113:		GetOutputFilePath			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/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:106:		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:122:	GetDefaultSource			0.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:131:	LocateBinaryInPluginDir			0.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:143:	IsUrl					100.0%
github.com/konveyor/crane/internal/plugin/plugin_manager_helper.go:149:	getData					80.0%
github.com/konveyor/crane/main.go:21:					main					0.0%
total:									(statements)				20.6%

Posted by CI

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
hack/minikube-create-user.sh (1)

155-162: ⚠️ Potential issue | 🔴 Critical

Context points to a non-existent kubeconfig user key.

set-context --user="$CONTEXT_NAME" references a different credentials entry than the one created by set-credentials "$USER_NAME". Since $USER_NAME and $CONTEXT_NAME are intentionally different (e.g., "alice" vs "minikube-alice"), the generated context will be broken—kubectl will fail to find the credentials it needs.

Fix

Change line 155 to use the same key that set-context references:

-kubectl config set-credentials "$USER_NAME" \
+kubectl config set-credentials "$CONTEXT_NAME" \
   --client-certificate="$USER_CRT" \
   --client-key="$USER_KEY" \
   --embed-certs=true >/dev/null
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hack/minikube-create-user.sh` around lines 155 - 162, The context is being
created with a user name that doesn't match the credentials entry:
set-credentials creates credentials under "$USER_NAME" but set-context uses
"$CONTEXT_NAME"; update the set-context call to use the same user key created by
set-credentials (i.e., change the --user value to "$USER_NAME") so the context's
user matches the credentials created by set-credentials (symbols:
set-credentials, set-context, $USER_NAME, $CONTEXT_NAME).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e-tests/tests/mtc_291_configmap_test.go`:
- Around line 76-83: The test currently reads only matches[0]; instead iterate
over all globbed matches returned by filepath.Glob and for each file path call
os.ReadFile and run the Expect assertions (Expect(err).NotTo(HaveOccurred()) and
Expect(string(content)).To(ContainSubstring(...))) so every matched ConfigMap
manifest is validated; update references to pattern, matches, configMap (or
content) and keep the same substring check but apply it inside a loop over
matches rather than a single file.

---

Outside diff comments:
In `@hack/minikube-create-user.sh`:
- Around line 155-162: The context is being created with a user name that
doesn't match the credentials entry: set-credentials creates credentials under
"$USER_NAME" but set-context uses "$CONTEXT_NAME"; update the set-context call
to use the same user key created by set-credentials (i.e., change the --user
value to "$USER_NAME") so the context's user matches the credentials created by
set-credentials (symbols: set-credentials, set-context, $USER_NAME,
$CONTEXT_NAME).
🪄 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: 6786be46-7a6c-4e2c-a8bb-e1938d36fe39

📥 Commits

Reviewing files that changed from the base of the PR and between d3506db and 52ecb0b.

📒 Files selected for processing (3)
  • .github/workflows/run-e2e-tests.yml
  • e2e-tests/tests/mtc_291_configmap_test.go
  • hack/minikube-create-user.sh

Comment thread e2e-tests/tests/mtc_291_configmap_test.go Outdated
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
@msajidmansoori12
Copy link
Copy Markdown
Contributor Author

@CodeRabbit summary

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

✅ Actions performed

Summary regeneration triggered.

@msajidmansoori12
Copy link
Copy Markdown
Contributor Author

@CodeRabbit summary

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

✅ Actions performed

Summary regeneration triggered.

@msajidmansoori12 msajidmansoori12 changed the title Mtc 291 Add non-admin ConfigMap migration test [MTC-291] and harden RBAC identity resolution Apr 7, 2026
…ntexts

Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
e2e-tests/tests/mtc_291_configmap_test.go (1)

82-91: Consider adding break after finding the expected ConfigMap.

The loop continues iterating after setting foundExpectedConfigMap = true. While functionally correct, this is slightly inefficient and could cause the test to fail on a read error for an unrelated ConfigMap file even after the expected one was found.

♻️ Proposed fix
 		for _, match := range matches {
 			content, err := os.ReadFile(match)
 			Expect(err).NotTo(HaveOccurred())
 			if strings.Contains(string(content), expectedData) {
 				foundExpectedConfigMap = true
+				break
 			}
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-tests/tests/mtc_291_configmap_test.go` around lines 82 - 91, The loop
reading files in the test uses matches and sets foundExpectedConfigMap to true
when expectedData is found but continues iterating; after setting
foundExpectedConfigMap = true inside the loop (the block that checks
strings.Contains(string(content), expectedData)), add a break to exit the loop
immediately so you avoid unnecessary file reads and potential unrelated read
errors after the matching ConfigMap is found (update the loop that reads match,
err, and checks expectedData).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e-tests/tests/mtc_291_configmap_test.go`:
- Line 105: The log message uses the wrong variable: replace the format argument
`namespace` in the log.Printf call with the variable that holds the ConfigMap
name (the one used to validate "redis-config", e.g. `configMapName` or
`redisConfig`) so the message reads the ConfigMap name instead of the namespace;
keep the same format string and ensure the chosen identifier is in scope where
log.Printf is called.

---

Nitpick comments:
In `@e2e-tests/tests/mtc_291_configmap_test.go`:
- Around line 82-91: The loop reading files in the test uses matches and sets
foundExpectedConfigMap to true when expectedData is found but continues
iterating; after setting foundExpectedConfigMap = true inside the loop (the
block that checks strings.Contains(string(content), expectedData)), add a break
to exit the loop immediately so you avoid unnecessary file reads and potential
unrelated read errors after the matching ConfigMap is found (update the loop
that reads match, err, and checks expectedData).
🪄 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: 2c01a2ef-ad02-47a8-bde2-85183f363354

📥 Commits

Reviewing files that changed from the base of the PR and between 6b37c65 and fecf92c.

📒 Files selected for processing (2)
  • e2e-tests/framework/client.go
  • e2e-tests/tests/mtc_291_configmap_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e-tests/framework/client.go

Comment thread e2e-tests/tests/mtc_291_configmap_test.go Outdated
@msajidmansoori12 msajidmansoori12 removed the request for review from stillalearner April 9, 2026 07:35
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
e2e-tests/tests/mtc_291_configmap_test.go (1)

82-104: Deduplicate the expected ConfigMap payload literal.

The same payload string is asserted twice. Reusing one variable avoids drift between output-dir and target-cluster assertions.

♻️ Proposed refactor
-		expectedData := `redis-config: "maxmemory 2mb  \nmaxmemory-policy allkeys-lru\n"`
+		expectedRedisConfigData := `redis-config: "maxmemory 2mb  \nmaxmemory-policy allkeys-lru\n"`
 		foundExpectedConfigMap := false
 		for _, match := range matches {
 			content, err := os.ReadFile(match)
 			Expect(err).NotTo(HaveOccurred())
-			if strings.Contains(string(content), expectedData) {
+			if strings.Contains(string(content), expectedRedisConfigData) {
 				foundExpectedConfigMap = true
 			}
 		}
 		Expect(foundExpectedConfigMap).To(BeTrue(), "expected at least one ConfigMap manifest to contain redis-config data")
@@
-		Expect(output).To(ContainSubstring(`redis-config: "maxmemory 2mb  \nmaxmemory-policy allkeys-lru\n"`))
+		Expect(output).To(ContainSubstring(expectedRedisConfigData))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-tests/tests/mtc_291_configmap_test.go` around lines 82 - 104, The test
repeats the same raw ConfigMap payload literal twice; keep a single canonical
variable (expectedData) and reuse it for both checks to avoid drift: locate the
expectedData declaration and the Expect(output).To(ContainSubstring(...))
assertion and replace the duplicated literal in the latter with the expectedData
variable so both the file-content loop and the kubectl output assertion
reference the same symbol (expectedData).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@e2e-tests/tests/mtc_291_configmap_test.go`:
- Around line 82-104: The test repeats the same raw ConfigMap payload literal
twice; keep a single canonical variable (expectedData) and reuse it for both
checks to avoid drift: locate the expectedData declaration and the
Expect(output).To(ContainSubstring(...)) assertion and replace the duplicated
literal in the latter with the expectedData variable so both the file-content
loop and the kubectl output assertion reference the same symbol (expectedData).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6ddbcc11-75cb-4c6e-bb19-cb928ab7ce6c

📥 Commits

Reviewing files that changed from the base of the PR and between fecf92c and 8391ca6.

📒 Files selected for processing (1)
  • e2e-tests/tests/mtc_291_configmap_test.go

Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
@midays midays merged commit 351b1e6 into migtools:main Apr 12, 2026
4 checks passed
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