Skip to content

Commit edce24e

Browse files
author
Vemula Anvesh
committed
test(argocd): fix FallbackToAnySHA test to use a host not in the known-hosts list
gitea.internal.corp contains 'gitea.' which matches the known git host heuristic, so the test was actually hitting Pass 1, not the fallback. Replace with git.acme-corp.internal which has no known-host prefix, no chart-registry prefix, and no .git suffix, so resolveMultiSourceRevision genuinely falls through to the SHA-shape fallback (Pass 2). Made-with: Cursor
1 parent 80f81ac commit edce24e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

backend/plugins/argocd/tasks/sync_operation_extractor_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ func TestResolveMultiSourceRevision_GitLabSourceWins(t *testing.T) {
101101
}
102102

103103
func TestResolveMultiSourceRevision_FallbackToAnySHA(t *testing.T) {
104-
// No known git hosting service in sources; still picks the SHA by shape.
104+
// Neither source matches a known git hosting service (no github/gitlab/gitea/etc.
105+
// prefix). The function should still return the 40-hex SHA via the fallback
106+
// pass that accepts any commit-SHA-shaped revision regardless of source type.
105107
revisions := []string{"1.2.3", "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"}
106108
sources := []ArgocdApiSyncSource{
107109
{RepoURL: "gs://bucket/charts"},
108-
{RepoURL: "https://gitea.internal.corp/team/config"},
110+
{RepoURL: "https://git.acme-corp.internal/team/config"},
109111
}
110112
got := resolveMultiSourceRevision(revisions, sources)
111-
// gitea. host is in our list
112113
assert.Equal(t, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", got)
113114
}
114115

0 commit comments

Comments
 (0)