File tree Expand file tree Collapse file tree 6 files changed +57
-31
lines changed
digital-letters-component-tests Expand file tree Collapse file tree 6 files changed +57
-31
lines changed Original file line number Diff line number Diff line change @@ -155,13 +155,9 @@ jobs:
155155 uses : ./.github/workflows/stage-4-acceptance.yaml
156156 if : needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event_name == 'push' && github.ref == 'refs/heads/main')
157157 with :
158- build_datetime : " ${{ needs.metadata.outputs.build_datetime }}"
159- build_timestamp : " ${{ needs.metadata.outputs.build_timestamp }}"
160- build_epoch : " ${{ needs.metadata.outputs.build_epoch }}"
161- nodejs_version : " ${{ needs.metadata.outputs.nodejs_version }}"
162- python_version : " ${{ needs.metadata.outputs.python_version }}"
163- terraform_version : " ${{ needs.metadata.outputs.terraform_version }}"
164158 version : " ${{ needs.metadata.outputs.version }}"
159+ target_environment : " pr${{ needs.metadata.outputs.pr_number }}"
160+ target_account_group : nhs-notify-digital-letters-dev
165161 secrets : inherit
166162 publish-stage : # Recommended maximum execution time is 10 minutes
167163 name : " Publish stage"
Original file line number Diff line number Diff line change 6262 --targetAccountGroup "nhs-notify-digital-letters-dev" \
6363 --targetComponent "${{ matrix.component }}" \
6464 --terraformAction "apply"
65+
66+ acceptance-stage : # Recommended maximum execution time is 10 minutes
67+ name : " Acceptance stage"
68+ needs : [ deploy-main]
69+ uses : ./.github/workflows/stage-4-acceptance.yaml
70+ with :
71+ version : " main"
72+ target_environment : " main"
73+ target_account_group : nhs-notify-digital-letters-dev
74+ secrets : inherit
Original file line number Diff line number Diff line change @@ -3,32 +3,16 @@ name: "Acceptance stage"
33on :
44 workflow_call :
55 inputs :
6- build_datetime :
7- description : " Build datetime, set by the CI/CD pipeline workflow"
8- required : true
9- type : string
10- build_timestamp :
11- description : " Build timestamp, set by the CI/CD pipeline workflow"
12- required : true
13- type : string
14- build_epoch :
15- description : " Build epoch, set by the CI/CD pipeline workflow"
16- required : true
17- type : string
18- nodejs_version :
19- description : " Node.js version, set by the CI/CD pipeline workflow"
20- required : true
21- type : string
22- python_version :
23- description : " Python version, set by the CI/CD pipeline workflow"
6+ version :
7+ description : " Version of the software, set by the CI/CD pipeline workflow"
248 required : true
25- type : string
26- terraform_version :
27- description : " Terraform version, set by the CI/CD pipeline workflow "
9+ type : string#
10+ target_environment :
11+ description : " Environment being tested "
2812 required : true
2913 type : string
30- version :
31- description : " Version of the software, set by the CI/CD pipeline workflow "
14+ target_account_group :
15+ description : " Account for the environment being tested "
3216 required : true
3317 type : string
3418
Original file line number Diff line number Diff line change 1+ // Envar Based
2+ // Environment Configuration
3+ export const ENV = process . env . ENVIRONMENT || 'main' ;
4+
5+ // Compound Scope Indicator
6+ export const CSI = `nhs-${ ENV } -dl` ;
7+
8+ // Lambda Names
9+ export const MESH_POLL_LAMBDA_NAME = `${ CSI } -mesh-poll` ;
10+ export const TTL_CREATE_LAMBDA_NAME = `${ CSI } -ttl-create` ;
11+ export const TTL_POLL_LAMBDA_NAME = `${ CSI } -ttl-poll` ;
12+
13+ // Queue Names
14+ export const TTL_QUEUE_NAME = `${ CSI } -ttl-queue` ;
15+ export const TTL_DLQ_NAME = `${ CSI } -ttl-dlq` ;
Original file line number Diff line number Diff line change 11import { expect , test } from '@playwright/test' ;
2+ import { ENV } from 'constants/backend-constants' ;
3+ import { listBuckets } from 'helpers/s3-helpers' ;
24
35test . describe ( 'Digital Letters' , ( ) => {
4- test ( 'should pass' , async ( ) => {
5- expect ( true ) . toBeTruthy ( ) ;
6+ test ( 'should contain a bucket with dl-letters in its name' , async ( ) => {
7+ const buckets = await listBuckets ( ENV ) ;
8+ expect ( buckets . some ( b => b . includes ( 'dl-letters' ) ) ) . toBeTruthy ( ) ;
69 } ) ;
710} ) ;
Original file line number Diff line number Diff line change 1+ import { S3Client , ListBucketsCommand } from "@aws-sdk/client-s3" ;
2+
3+ const s3 = new S3Client ( {
4+ region : process . env . AWS_REGION || "eu-west-2" ,
5+ } ) ;
6+
7+
8+ export async function listBuckets ( substring : string ) : Promise < string [ ] > {
9+ const resp = await s3 . send ( new ListBucketsCommand ( { } ) ) ;
10+ const buckets = resp . Buckets ?? [ ] ;
11+ if ( ! substring ) {
12+ return buckets . map ( b => b . Name ! ) . filter ( Boolean ) ;
13+ }
14+ const needle = substring . toLowerCase ( ) ;
15+ return buckets
16+ . map ( b => b . Name )
17+ . filter ( ( name ) : name is string => ! ! name && name . toLowerCase ( ) . includes ( needle ) ) ;
18+ }
You can’t perform that action at this time.
0 commit comments