Skip to content

Commit d210d25

Browse files
GrimmiMeloniclaude
andcommitted
fix: address code review findings
- Remove misleading "Exported for testing" comment from unexported function - Remove redundant length check and magic number in ExtractKindClusterName - Fix stale comments about image counts (9 total, not 10) - Update tests to use realistic scanner-v4 image references - Change test to use quay.io paths instead of localhost Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent d8c7bc0 commit d210d25

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

internal/cluster/kind.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ func IsKindCluster() bool {
1313
}
1414

1515
// isKindContext checks if the given context name indicates a kind cluster.
16-
// Exported for testing.
1716
func isKindContext(contextName string) bool {
1817
if contextName == "" {
1918
return false
@@ -27,8 +26,8 @@ func isKindContext(contextName string) bool {
2726
// For context "kind", returns "kind".
2827
func ExtractKindClusterName(contextName string) string {
2928
// Remove "kind-" prefix if present
30-
if len(contextName) > 5 && strings.HasPrefix(strings.ToLower(contextName), "kind-") {
31-
return contextName[5:]
29+
if strings.HasPrefix(strings.ToLower(contextName), "kind-") {
30+
return contextName[len("kind-"):]
3231
}
3332
// If just "kind", return as-is
3433
return contextName

internal/deployer/deployer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ func (d *Deployer) detectAndLoadLocalImages(ctx context.Context) error {
490490
return nil
491491
}
492492

493-
// Calculate total images needed (7 main + 3 operator = 10)
493+
// Calculate total images needed (7 main + 2 operator = 9)
494494
totalExpected := totalRequiredImages
495495
d.logger.Infof("Found %d/%d images locally in podman", len(localImages), totalExpected)
496496

@@ -516,7 +516,7 @@ func (d *Deployer) shouldSkipCredentialVerification() bool {
516516
}
517517

518518
// If using some local images but not all, don't skip (need creds for remote pulls)
519-
// Total expected: 7 main + 3 operator = 10
519+
// Total expected: 7 main + 2 operator = 9
520520
totalExpected := totalRequiredImages
521521
if len(d.localImages) < totalExpected {
522522
d.logger.Dimf("Using %d/%d local images, remaining images will be pulled from quay.io",

internal/deployer/operator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ spec:
175175
"scanner-db:4.0.0": "quay.io/rhacs-eng/scanner-db:4.0.0",
176176
"central-db:4.0.0": "quay.io/rhacs-eng/central-db:4.0.0",
177177
"scanner-v4-db:4.0.0": "quay.io/rhacs-eng/scanner-v4-db:4.0.0",
178-
"scanner-v4-matcher:4.0.0": "quay.io/rhacs-eng/scanner-v4-matcher:4.0.0",
178+
"scanner-v4:4.0.0": "quay.io/rhacs-eng/scanner-v4:4.0.0",
179179
}
180180

181181
// Patch the CSV
@@ -222,7 +222,7 @@ spec:
222222
"RELATED_IMAGE_SCANNER_DB": "quay.io/rhacs-eng/scanner-db:4.0.0",
223223
"RELATED_IMAGE_CENTRAL_DB": "quay.io/rhacs-eng/central-db:4.0.0",
224224
"RELATED_IMAGE_SCANNER_V4_DB": "quay.io/rhacs-eng/scanner-v4-db:4.0.0",
225-
"RELATED_IMAGE_SCANNER_V4": "quay.io/rhacs-eng/scanner-v4-matcher:4.0.0",
225+
"RELATED_IMAGE_SCANNER_V4": "quay.io/rhacs-eng/scanner-v4:4.0.0",
226226
"RELATED_IMAGE_COLLECTOR": "quay.io/rhacs-eng/collector:4.0.0", // Not in local images, stays unchanged
227227
"OTHER_ENV": "some-value",
228228
}

internal/localimages/loading_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ func TestBuildKindLoadCommand(t *testing.T) {
3636
}{
3737
{
3838
name: "basic load",
39-
imageRef: "localhost/stackrox/main:4.10.0",
39+
imageRef: "quay.io/rhacs-eng/main:4.10.0",
4040
clusterName: "acs",
41-
expected: []string{"kind", "load", "docker-image", "localhost/stackrox/main:4.10.0", "-n", "acs"},
41+
expected: []string{"kind", "load", "docker-image", "quay.io/rhacs-eng/main:4.10.0", "-n", "acs"},
4242
},
4343
}
4444

0 commit comments

Comments
 (0)