-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into TT-1275-killgrave-requests
- Loading branch information
Showing
2 changed files
with
57 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package foundry | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/google/uuid" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestChartNameUniqueness(t *testing.T) { | ||
props := defaultProps() | ||
|
||
// Create two Chart instances | ||
chart1 := NewVersioned("", props) | ||
chart2 := NewVersioned("", props) | ||
|
||
// Assert that the names of the charts are unique | ||
require.NotEqual(t, chart1.GetName(), chart2.GetName(), "Chart names should be unique") | ||
} | ||
|
||
func TestChartNameWithFullNameOverrideUniqueness(t *testing.T) { | ||
// Generate unique names for testing | ||
name1 := fmt.Sprintf("custom-%s", uuid.New().String()[0:5]) | ||
name2 := fmt.Sprintf("custom-%s", uuid.New().String()[0:5]) | ||
|
||
// Create two Chart instances with different fullnameOverride | ||
chart1 := NewVersioned("", &Props{ | ||
Values: map[string]interface{}{ | ||
"fullnameOverride": name1, | ||
}, | ||
}) | ||
chart2 := NewVersioned("", &Props{ | ||
Values: map[string]interface{}{ | ||
"fullnameOverride": name2, | ||
}, | ||
}) | ||
|
||
// Assert that the names of the charts are unique and correct | ||
require.Equal(t, name1, chart1.GetName(), "Chart name should match the fullnameOverride") | ||
require.Equal(t, name2, chart2.GetName(), "Chart name should match the fullnameOverride") | ||
require.NotEqual(t, chart1.GetName(), chart2.GetName(), "Chart names should be unique when fullnameOverrides are different") | ||
} |