@@ -181,18 +181,24 @@ def add_feature_test_files(local_path):
181181 ]
182182
183183
184- def add_smoke_test_files (local_path ):
184+ def add_smoke_test_files (secretsmanager , local_path , env_name ):
185185 """Bake in v2 permissions for the smoke test application so that the
186186 v2 permissions model can be proven via smoke tests without
187187 requiring a dynamic layer rebuild between test setup and test execution.
188188 """
189189
190+ parameters_name = f"nhsd-nrlf--{ env_name } --smoke-test-parameters"
191+
192+ secret_value = secretsmanager .get_secret_value (SecretId = parameters_name )
193+ parameters = json .loads (secret_value ["SecretString" ])
194+ smoke_test_app_id = parameters .get ("nrlf_app_id" )
195+
190196 print ("Adding smoke test v2 permissions to temporary directory..." )
191197 org_permissions = {
192198 "consumer" : [
193199 (
194- "X26-NRL-6981ad7d-cff4-4613-93d0-df60e5e2fc52" ,
195- "SMOKETEST" , # ods_code
200+ smoke_test_app_id ,
201+ "SMOKETEST" ,
196202 [
197203 PointerTypes .MENTAL_HEALTH_PLAN .value
198204 ], # http://snomed.info/sct|736253002
@@ -201,16 +207,16 @@ def add_smoke_test_files(local_path):
201207 ],
202208 "producer" : [
203209 (
204- "X26-NRL-6981ad7d-cff4-4613-93d0-df60e5e2fc52" ,
205- "SMOKETEST" , # ods_code
210+ smoke_test_app_id ,
211+ "SMOKETEST" ,
206212 [
207213 PointerTypes .MENTAL_HEALTH_PLAN .value
208214 ], # http://snomed.info/sct|736253002
209215 [],
210216 ),
211217 (
212218 # For public tests - don't have a separate apigee app for 1DSync
213- "X26-NRL-6981ad7d-cff4-4613-93d0-df60e5e2fc52" ,
219+ smoke_test_app_id ,
214220 "SMOKETEST1DSYNC" ,
215221 [],
216222 [AccessControls .ALLOW_ALL_TYPES .value ],
@@ -249,13 +255,13 @@ def add_smoke_test_files(local_path):
249255
250256 print ("Adding smoke test v1 permissions to temporary directory..." )
251257 v1_permissions = [
252- (
258+ ( # not needed, won't hit this file
253259 "SMOKETEST1DSYNCV1" ,
254260 "SMOKETEST" ,
255- [], # not needed, won't hit this file
261+ [],
256262 ),
257263 (
258- "X26-NRL-6981ad7d-cff4-4613-93d0-df60e5e2fc52" ,
264+ smoke_test_app_id ,
259265 "SMOKETESTV1" ,
260266 [PointerTypes .MENTAL_HEALTH_PLAN .value ], # http://snomed.info/sct|736253002
261267 ),
@@ -270,7 +276,9 @@ def add_smoke_test_files(local_path):
270276 ]
271277
272278
273- def download_files (s3_client , bucket_name , local_path , file_names , folders ):
279+ def download_files (
280+ s3_client , bucket_name , local_path , file_names , folders , secretsmanager , env_name
281+ ):
274282 print (f"Downloading { len (file_names )} S3 files to temporary directory..." )
275283 local_path = Path (local_path )
276284
@@ -287,7 +295,7 @@ def download_files(s3_client, bucket_name, local_path, file_names, folders):
287295
288296 add_test_files ("K6PerformanceTest" , "Y05868.json" , local_path )
289297 add_feature_test_files (local_path )
290- add_smoke_test_files (local_path )
298+ add_smoke_test_files (secretsmanager , local_path , env_name )
291299
292300
293301def main (use_shared_resources : str , env : str , workspace : str , path_to_store : str ):
@@ -299,12 +307,15 @@ def main(use_shared_resources: str, env: str, workspace: str, path_to_store: str
299307 s3 = boto_session .client ("s3" )
300308 files , folders = get_file_folders (s3 , bucket )
301309
310+ secretsmanager = boto_session .client ("secretsmanager" , region_name = "eu-west-2" )
302311 download_files (
303312 s3 ,
304313 bucket ,
305314 path .abspath (path .join (path_to_store + "/nrlf_permissions" )),
306315 files ,
307316 folders ,
317+ secretsmanager ,
318+ env_name = env ,
308319 )
309320 print ("Downloaded S3 permissions..." )
310321
0 commit comments