99)
1010
1111func TestConfigurationResources (t * testing.T ) {
12- suite .Run (t , new (ConfigurationResourcesTestSuite ))
12+ suite .Run (t , new (ConfigurationResourcesConfigMapsTestSuite ))
13+ suite .Run (t , new (ConfigurationResourcesSecretsTestSuite ))
14+ suite .Run (t , new (ConfigurationResourcesPlatformCredentialsSetTestSuite ))
1315}
1416
1517type ConfigurationResourcesTestSuite struct {
@@ -21,22 +23,26 @@ type ConfigurationResourcesTestSuite struct {
2123 stackVersion string
2224}
2325
24- func (suite * ConfigurationResourcesTestSuite ) SetupTest () {
25- suite .stacksetName = "stackset-cr"
26+ type ConfigurationResourcesConfigMapsTestSuite struct {
27+ ConfigurationResourcesTestSuite
28+ }
29+
30+ func (suite * ConfigurationResourcesConfigMapsTestSuite ) SetupTest () {
31+ suite .stacksetName = "stackset-cr-cm"
2632 suite .stackVersion = "v1"
2733
2834 suite .stacksetSpecFactory = NewTestStacksetSpecFactory (suite .stacksetName )
2935}
3036
31- func (suite * ConfigurationResourcesTestSuite ) TearDownTest () {
37+ func (suite * ConfigurationResourcesConfigMapsTestSuite ) TearDownTest () {
3238 err := deleteStackset (suite .stacksetName )
3339 suite .Require ().NoError (err )
3440}
3541
3642// TestReferencedConfigMaps tests that ConfigMaps referenced in the StackSet spec are owned by the Stack.
37- func (suite * ConfigurationResourcesTestSuite ) TestReferencedConfigMaps () {
43+ func (suite * ConfigurationResourcesConfigMapsTestSuite ) TestReferencedConfigMaps () {
3844 // Create a ConfigMap in the cluster following the naming convention
39- configMapName := "stackset-cr-v1-my-configmap"
45+ configMapName := "stackset-cr-cm- v1-my-configmap"
4046 createConfigMap (suite .T (), configMapName )
4147
4248 // Add the ConfigMap reference to the StackSet spec
@@ -70,10 +76,26 @@ func (suite *ConfigurationResourcesTestSuite) TestReferencedConfigMaps() {
7076 suite .Require ().NoError (err )
7177}
7278
79+ func (suite * ConfigurationResourcesSecretsTestSuite ) SetupTest () {
80+ suite .stacksetName = "stackset-cr-sec"
81+ suite .stackVersion = "v1"
82+
83+ suite .stacksetSpecFactory = NewTestStacksetSpecFactory (suite .stacksetName )
84+ }
85+
86+ func (suite * ConfigurationResourcesSecretsTestSuite ) TearDownTest () {
87+ err := deleteStackset (suite .stacksetName )
88+ suite .Require ().NoError (err )
89+ }
90+
91+ type ConfigurationResourcesSecretsTestSuite struct {
92+ ConfigurationResourcesTestSuite
93+ }
94+
7395// TestReferencedSecrets tests that Secrets referenced in the StackSet spec are owned by the Stack.
74- func (suite * ConfigurationResourcesTestSuite ) TestReferencedSecrets () {
96+ func (suite * ConfigurationResourcesSecretsTestSuite ) TestReferencedSecrets () {
7597 // Create a Secret in the cluster following the naming convention
76- secretName := "stackset-cr-v1-my-secret"
98+ secretName := "stackset-cr-sec- v1-my-secret"
7799 createSecret (suite .T (), secretName )
78100
79101 // Add the Secret reference to the StackSet spec
@@ -107,9 +129,25 @@ func (suite *ConfigurationResourcesTestSuite) TestReferencedSecrets() {
107129 suite .Require ().NoError (err )
108130}
109131
132+ type ConfigurationResourcesPlatformCredentialsSetTestSuite struct {
133+ ConfigurationResourcesTestSuite
134+ }
135+
136+ func (suite * ConfigurationResourcesPlatformCredentialsSetTestSuite ) SetupTest () {
137+ suite .stacksetName = "stackset-cr-pcs"
138+ suite .stackVersion = "v1"
139+
140+ suite .stacksetSpecFactory = NewTestStacksetSpecFactory (suite .stacksetName )
141+ }
142+
143+ func (suite * ConfigurationResourcesPlatformCredentialsSetTestSuite ) TearDownTest () {
144+ err := deleteStackset (suite .stacksetName )
145+ suite .Require ().NoError (err )
146+ }
147+
110148// TestGeneratedPCS tests that PlatformCredentialsSets defined in the StackSet are
111149// correctly created and owned by the Stack.
112- func (suite * ConfigurationResourcesTestSuite ) TestGeneratedPCS () {
150+ func (suite * ConfigurationResourcesPlatformCredentialsSetTestSuite ) TestGeneratedPCS () {
113151 // Add the PlatformCredentialsSet reference to the StackSet spec
114152 pcsName := suite .stacksetName + "-" + suite .stackVersion + "-my-pcs"
115153 suite .stacksetSpecFactory .AddPlatformCredentialsSetDefinition (pcsName )
0 commit comments