@@ -89,19 +89,19 @@ func TestAcceptanceForSecretResource(t *testing.T) {
8989 CheckDestroy : nil ,
9090 Steps : []resource.TestStep {
9191 {
92- Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterGroupScope , "docker" ),
92+ Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterGroupScope , WithSecretType ( "docker" ) ),
9393 Check : testConfig .checkResourceAttributes (commonscope .ClusterGroupScope ),
9494 },
9595 {
96- Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterScope , "docker" ),
96+ Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterScope , WithSecretType ( "docker" ) ),
9797 Check : testConfig .checkResourceAttributes (commonscope .ClusterScope ),
9898 },
9999 {
100- Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterGroupScope , "opaque" ),
100+ Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterGroupScope , WithSecretType ( "opaque" ) ),
101101 Check : testConfig .checkResourceAttributes (commonscope .ClusterGroupScope ),
102102 },
103103 {
104- Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterScope , "opaque" ),
104+ Config : testConfig .getTestResourceBasicConfigValue (commonscope .ClusterScope , WithSecretType ( "opaque" ) ),
105105 Check : testConfig .checkResourceAttributes (commonscope .ClusterScope ),
106106 },
107107 },
@@ -110,9 +110,9 @@ func TestAcceptanceForSecretResource(t *testing.T) {
110110 t .Log ("secret resource acceptance test complete!" )
111111}
112112
113- func (testConfig * testAcceptanceConfig ) getTestResourceBasicConfigValue (scope commonscope.Scope , secretType string , opts ... OperationOption ) string {
113+ func (testConfig * testAcceptanceConfig ) getTestResourceBasicConfigValue (scope commonscope.Scope , opts ... OperationOption ) string {
114114 helperBlock , scopeBlock := testConfig .ScopeHelperResources .GetTestResourceHelperAndScope (scope , secretscope .ScopesAllowed [:])
115- secretSpec := testConfig .getTestSecretResourceSpec (secretType , opts ... )
115+ secretSpec := testConfig .getTestSecretResourceSpec (opts ... )
116116
117117 if _ , found := os .LookupEnv ("ENABLE_SECRET_ENV_TEST" ); ! found {
118118 clStr := fmt .Sprintf (`
@@ -267,6 +267,7 @@ type (
267267 username string
268268 password string
269269 imageRegistryURL string
270+ secretType string
270271 }
271272
272273 OperationOption func (* OperationConfig )
@@ -290,12 +291,19 @@ func WithURL(val string) OperationOption {
290291 }
291292}
292293
294+ func WithSecretType (val string ) OperationOption {
295+ return func (config * OperationConfig ) {
296+ config .secretType = val
297+ }
298+ }
299+
293300// getTestSecretResourceSpec builds the input block for cluster secret resource based a recipe.
294- func (testConfig * testAcceptanceConfig ) getTestSecretResourceSpec (secretType string , opts ... OperationOption ) string {
301+ func (testConfig * testAcceptanceConfig ) getTestSecretResourceSpec (opts ... OperationOption ) string {
295302 cfg := & OperationConfig {
296303 username : "someusername" ,
297304 password : "somepassword" ,
298305 imageRegistryURL : "someregistryurl" ,
306+ secretType : "docker" ,
299307 }
300308
301309 for _ , o := range opts {
@@ -304,7 +312,7 @@ func (testConfig *testAcceptanceConfig) getTestSecretResourceSpec(secretType str
304312
305313 var secretSpec string
306314
307- switch secretType {
315+ switch cfg . secretType {
308316 case "docker" :
309317 secretSpec = fmt .Sprintf (` spec {
310318 docker_config_json {
0 commit comments