Skip to content

crane validate: Test scanner deduplication#557

Open
nachandr wants to merge 1 commit into
migtools:mainfrom
nachandr:scanner_deduplication
Open

crane validate: Test scanner deduplication#557
nachandr wants to merge 1 commit into
migtools:mainfrom
nachandr:scanner_deduplication

Conversation

@nachandr

@nachandr nachandr commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #385

Summary by CodeRabbit

  • Tests
    • Added end-to-end test coverage for validating Crane's deduplication behavior when processing Kubernetes manifests of the same resource type.

Signed-off-by: Nandini Chandra <nachandr@redhat.com>
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds two Kubernetes Deployment YAML fixtures (test-deployment-1 and test-deployment-2, both in test-namespace) and a Ginkgo tier1 e2e test (MTA-385) that runs crane validate in live mode with these duplicate-GVK inputs and asserts that deduplication, report metadata, compatibility counts, and absence of a failures directory are all correct.

Changes

MTA-385 Duplicate GVK E2E Test

Layer / File(s) Summary
Test fixture Deployment manifests
e2e-tests/testdata/issue-385-duplicate-deployment-1.yaml, e2e-tests/testdata/issue-385-duplicate-deployment-2.yaml
Two apps/v1 Deployment YAMLs added as static test inputs: test-deployment-1 (nginx:latest, 1 replica) and test-deployment-2 (nginx:1.19, 2 replicas), both in test-namespace with label app: test.
Test scaffolding, scenario setup, and skip logic
e2e-tests/tests/tier1/mta_385_validate_duplicate_gvk_test.go
Ginkgo Describe/It block creates temp directories, copies both fixture files into an input/ folder, builds the live validation scenario, and conditionally skips when the required non-admin target context is missing.
crane validate execution and report assertions
e2e-tests/tests/tier1/mta_385_validate_duplicate_gvk_test.go
Calls runner.Validate with JSON output, reads and unmarshals report.json into ValidationReport, asserts Mode == "live", TotalScanned == 1, Compatible == 1, Incompatible == 0, exactly one matching Deployment with StatusOK in report.Results, and confirms no validate/failures/ directory is created.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • migtools/crane#421: Both PRs add tier1 e2e coverage for crane validate in live mode by asserting contents of validate/report.json via runner.Validate; this PR adds deduplication assertions while the referenced PR validates suggestion fields for alternative GV.

Suggested reviewers

  • msajidmansoori12
  • aufi

Poem

🐇 Two deployments walked in, same GVK they wore,
Crane peeked at the report and counted just one, no more.
TotalScanned == 1 — the rabbit cheered with glee,
No failures/ in sight, the cluster runs free!
Duplicates deduplicated, as tests ought to be. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'crane validate: Test scanner deduplication' directly and specifically describes the main purpose of the PR, which adds a test for Crane's scanner deduplication behavior during validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

@nachandr nachandr requested a review from stillalearner June 21, 2026 02:11
@github-actions

Copy link
Copy Markdown

Test Coverage Report

Total: 46.6%

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.6%
  • github.com/konveyor/crane/internal/buildinfo — 100.0%
  • github.com/konveyor/crane/internal/file — 72.8%
  • 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:42:			Complete					100.0%
github.com/konveyor/crane/cmd/apply/apply.go:48:			Validate					87.5%
github.com/konveyor/crane/cmd/apply/apply.go:62:			Run						0.0%
github.com/konveyor/crane/cmd/apply/apply.go:66:			NewApplyCommand					0.0%
github.com/konveyor/crane/cmd/apply/apply.go:107:			getStageNames					100.0%
github.com/konveyor/crane/cmd/apply/apply.go:115:			addFlagsForOptions				0.0%
github.com/konveyor/crane/cmd/apply/apply.go:129:			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:122:			validateExportNamespace				87.5%
github.com/konveyor/crane/cmd/export/export.go:139:			allResourceListsForbidden			87.5%
github.com/konveyor/crane/cmd/export/export.go:157:			Run						0.0%
github.com/konveyor/crane/cmd/export/export.go:270:			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/internal/apply/kustomize.go:30:		ApplySingleStage				0.0%
github.com/konveyor/crane/internal/apply/kustomize.go:79:		ApplyMultiStage					0.0%
github.com/konveyor/crane/internal/apply/kustomize.go:133:		runKustomizeBuild				0.0%
github.com/konveyor/crane/internal/apply/kustomize.go:142:		filterClusterScopedResources			82.4%
github.com/konveyor/crane/internal/apply/kustomize.go:198:		splitMultiDocYAMLToFiles			85.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				0.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.6%

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.

Caution

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

⚠️ Outside diff range comments (1)
e2e-tests/testdata/issue-385-duplicate-deployment-1.yaml (1)

1-21: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Rename fixture files to match the required YAML naming convention.

issue-385-duplicate-deployment-1.yaml (and its sibling issue-385-duplicate-deployment-2.yaml) does not follow Kind_group_version_namespace_name.yaml. Please rename both fixtures and update the corresponding references in e2e-tests/tests/tier1/mta_385_validate_duplicate_gvk_test.go (Lines 38-39).

As per coding guidelines, "**/*.yaml: Resource names should follow format: Kind_group_version_namespace_name.yaml."

🤖 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 `@e2e-tests/testdata/issue-385-duplicate-deployment-1.yaml` around lines 1 -
21, The fixture files issue-385-duplicate-deployment-1.yaml and
issue-385-duplicate-deployment-2.yaml do not follow the required naming
convention of Kind_group_version_namespace_name.yaml. Rename both files to match
the convention based on their content: use Deployment as the Kind, apps as the
group, v1 as the version, test-namespace as the namespace, and test-deployment-1
and test-deployment-2 as the names respectively. Then update the corresponding
file path references in the mta_385_validate_duplicate_gvk_test.go test file to
point to the newly renamed fixture files.

Source: Coding guidelines

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

101-103: ⚡ Quick win

Assert the exact cluster context value, not just non-empty.

Given this test’s goal is report metadata correctness, report.ClusterContext should match scenario.KubectlTgtNonAdmin.Context; a non-empty check can miss regressions that write the wrong context.

Suggested assertion update
-		Expect(report.ClusterContext).NotTo(BeEmpty(), "expected clusterContext to be set in live mode")
+		Expect(report.ClusterContext).To(Equal(scenario.KubectlTgtNonAdmin.Context),
+			"expected clusterContext to match the target non-admin context")
🤖 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 `@e2e-tests/tests/tier1/mta_385_validate_duplicate_gvk_test.go` around lines
101 - 103, Replace the NotTo(BeEmpty()) assertion on report.ClusterContext with
a direct equality check to verify it matches the expected value
scenario.KubectlTgtNonAdmin.Context. Change the Expect statement to compare
report.ClusterContext with scenario.KubectlTgtNonAdmin.Context using Equal()
matcher to ensure the correct context is being set in the report, rather than
just checking for a non-empty value which could miss regressions where an
incorrect context is written.
🤖 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.

Outside diff comments:
In `@e2e-tests/testdata/issue-385-duplicate-deployment-1.yaml`:
- Around line 1-21: The fixture files issue-385-duplicate-deployment-1.yaml and
issue-385-duplicate-deployment-2.yaml do not follow the required naming
convention of Kind_group_version_namespace_name.yaml. Rename both files to match
the convention based on their content: use Deployment as the Kind, apps as the
group, v1 as the version, test-namespace as the namespace, and test-deployment-1
and test-deployment-2 as the names respectively. Then update the corresponding
file path references in the mta_385_validate_duplicate_gvk_test.go test file to
point to the newly renamed fixture files.

---

Nitpick comments:
In `@e2e-tests/tests/tier1/mta_385_validate_duplicate_gvk_test.go`:
- Around line 101-103: Replace the NotTo(BeEmpty()) assertion on
report.ClusterContext with a direct equality check to verify it matches the
expected value scenario.KubectlTgtNonAdmin.Context. Change the Expect statement
to compare report.ClusterContext with scenario.KubectlTgtNonAdmin.Context using
Equal() matcher to ensure the correct context is being set in the report, rather
than just checking for a non-empty value which could miss regressions where an
incorrect context is written.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38063999-ce56-4f56-8223-9baf438d9af8

📥 Commits

Reviewing files that changed from the base of the PR and between d538d3d and 91b224a.

📒 Files selected for processing (3)
  • e2e-tests/testdata/issue-385-duplicate-deployment-1.yaml
  • e2e-tests/testdata/issue-385-duplicate-deployment-2.yaml
  • e2e-tests/tests/tier1/mta_385_validate_duplicate_gvk_test.go

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: (tier1) Scanner: Test deduplication

1 participant