Skip to content

Commit

Permalink
fix: only use the hash for the namespace to prevent errors caused by …
Browse files Browse the repository at this point in the history
…special characters in test case names
  • Loading branch information
dervoeti committed Nov 6, 2024
1 parent d294f62 commit fbf9921
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions pkg/test/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ func determineNamespace(testcaseName string) string {
hasher.Write([]byte(testcaseName))
hash := hex.EncodeToString(hasher.Sum(nil))

truncatedFileName := testcaseName
if len(truncatedFileName) > 32 {
truncatedFileName = truncatedFileName[:32]
}
return fmt.Sprintf("kuttl-%s-%s", truncatedFileName, hash[:10])
return fmt.Sprintf("kuttl-%s", hash[:10])
}

// LoadTests loads all of the tests in a given directory.
Expand Down
2 changes: 1 addition & 1 deletion pkg/test/harness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ func TestAddNodeCaches(t *testing.T) {
}

func TestDetermineNamespace(t *testing.T) {
assert.Equal(t, "kuttl-smoke_airflow-2.9.2_openshift-fa-c7e64f7a24", determineNamespace("smoke_airflow-2.9.2_openshift-false_executor-kubernetes"))
assert.Equal(t, "kuttl-c7e64f7a24", determineNamespace("smoke_airflow-2.9.2_openshift-false_executor-kubernetes"))
}

0 comments on commit fbf9921

Please sign in to comment.