@@ -165,6 +165,7 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
165165 {Name : "existing_secrets_manager_instance_crn" , Value : permanentResources ["secretsManagerCRN" ], DataType : "string" },
166166 {Name : "service_credential_secrets" , Value : serviceCredentialSecrets , DataType : "list(object)" },
167167 {Name : "service_credential_names" , Value : string (serviceCredentialNamesJSON ), DataType : "map(string)" },
168+ {Name : "admin_pass" , Value : GetRandomAdminPassword (t ), DataType : "string" },
168169 }
169170 err = options .RunSchematicTest ()
170171 assert .Nil (t , err , "This should not have errored" )
@@ -173,15 +174,6 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
173174func TestRunStandardUpgradeSolution (t * testing.T ) {
174175 t .Parallel ()
175176
176- // Generate a 15 char long random string for the admin_pass
177- randomBytes := make ([]byte , 13 )
178- _ , err := rand .Read (randomBytes )
179- if err != nil {
180- log .Fatal (err )
181- }
182- // add character prefix to avoid generated password beginning with special char and must have a number
183- randomPass := "A1" + base64 .URLEncoding .EncodeToString (randomBytes )[:13 ]
184-
185177 options := testhelper .TestOptionsDefault (& testhelper.TestOptions {
186178 Testing : t ,
187179 TerraformDir : standardSolutionTerraformDir ,
@@ -196,7 +188,6 @@ func TestRunStandardUpgradeSolution(t *testing.T) {
196188 "kms_endpoint_type" : "public" ,
197189 "provider_visibility" : "public" ,
198190 "resource_group_name" : options .Prefix ,
199- "admin_pass" : randomPass ,
200191 }
201192
202193 output , err := options .RunTestUpgrade ()
@@ -205,3 +196,12 @@ func TestRunStandardUpgradeSolution(t *testing.T) {
205196 assert .NotNil (t , output , "Expected some output" )
206197 }
207198}
199+
200+ func GetRandomAdminPassword (t * testing.T ) string {
201+ // Generate a 15 char long random string for the admin_pass
202+ randomBytes := make ([]byte , 13 )
203+ _ , randErr := rand .Read (randomBytes )
204+ require .Nil (t , randErr ) // do not proceed if we can't gen a random password
205+ randomPass := "A1" + base64 .URLEncoding .EncodeToString (randomBytes )[:13 ]
206+ return randomPass
207+ }
0 commit comments