6666 LS_VERSION=$(docker ps | grep localstack | cut -d " " -f4 | cut -d ":" -f2)
6767 exit $(test "x${LS_VERSION}" = "x3.2.0")
6868
69- cloud-pods-test :
69+ cloud-pods-save- test :
7070 name : ' Test Cloud Pods Action'
7171 runs-on : ubuntu-latest
72+ outputs :
73+ pod-name : ${{ steps.pod_name.outputs.name }}
7274 steps :
7375 - name : ⚡️ Checkout the repository
7476 uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
8890 LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
8991 GH_ACTION_VERSION : ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.ref_name }}
9092
93+ - name : Generate random pod name
94+ id : pod_name
95+ run : echo "name=cloud-pods-test-$RANDOM" >> $GITHUB_OUTPUT
96+
9197 - name : Run AWS commands
9298 run : |
9399 awslocal s3 mb s3://test
@@ -99,21 +105,26 @@ jobs:
99105 uses : LocalStack/setup-localstack@${{ env.GH_ACTION_VERSION }}
100106 with : |-
101107 {
102- "state-name": "cloud-pods-test ",
108+ "state-name": "${{ steps.pod_name.outputs.name }} ",
103109 "state-action": "save",
104110 }
105111 env :
106112 LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
107113 GH_ACTION_VERSION : ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.ref_name }}
108114
109- local-state-test :
110- name : ' Test Local State Action'
115+ - name : Verify Cloud Pod
116+ run : |
117+ localstack pod list | grep ${{ steps.pod_name.outputs.name }}
118+
119+ load-cloud-pod-test :
120+ name : ' Test Loading Cloud Pod'
111121 runs-on : ubuntu-latest
122+ needs : cloud-pods-save-test
112123 steps :
113124 - name : ⚡️ Checkout the repository
114125 uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
115126
116- - name : Start LocalStack
127+ - name : Start LocalStack and Load Pod
117128 uses : jenseng/dynamic-uses@8bc24f0360175e710da532c4d19eafdbed489a06 # v1
118129 with :
119130 uses : LocalStack/setup-localstack@${{ env.GH_ACTION_VERSION }}
@@ -123,31 +134,102 @@ jobs:
123134 "install-awslocal": "true",
124135 "configuration": "DEBUG=1",
125136 "use-pro": "true",
126- "state-name": "cloud-pods-test",
127- "state-action": "load",
128- "state-backend": "local",
137+ "state-name": "${{ needs.cloud-pods-test.outputs.pod-name }}",
138+ "state-action": "load"
129139 }
130140 env :
131141 LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
132142 GH_ACTION_VERSION : ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.ref_name }}
133143
134- - name : Run AWS Commands
144+ - name : Verify loaded resources
135145 run : |
136- awslocal s3 mb s3://test
137- awslocal s3 rb s3://test
138- awslocal sqs create-queue --queue-name test-queue
139- awslocal sqs delete-queue --queue-url $(awslocal sqs get-queue-url --queue-name test-queue --output text)
146+ echo "Verifying S3 bucket..."
147+ awslocal s3 ls | grep "test"
148+ echo "Verifying SQS queue..."
149+ awslocal sqs list-queues | grep "test-queue"
150+
151+ - name : Clean up remote pod
152+ run : localstack pod delete --yes ${{ needs.cloud-pods-test.outputs.pod-name }}
153+
154+
155+ - name : Verify Cloud Pod deletion
156+ run : |
157+ echo "Verifying that the pod has been deleted..."
158+ if localstack pod list | grep -q ${{ needs.cloud-pods-test.outputs.pod-name }}; then
159+ echo "Pod ${{ needs.cloud-pods-test.outputs.pod-name }} was not deleted."
160+ exit 1
161+ fi
162+ echo "Pod successfully deleted."
163+
164+ local-state-save-test :
165+ name : ' Test Local State Save Action'
166+ runs-on : ubuntu-latest
167+ steps :
168+ - name : ⚡️ Checkout the repository
169+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
170+
171+ - name : Start LocalStack
172+ uses : jenseng/dynamic-uses@8bc24f0360175e710da532c4d19eafdbed489a06 # v1
173+ with :
174+ uses : LocalStack/setup-localstack@${{ env.GH_ACTION_VERSION }}
175+ with : |-
176+ {
177+ "image-tag": "latest",
178+ "install-awslocal": "true",
179+ "configuration": "DEBUG=1",
180+ "use-pro": "true",
181+ }
182+ env :
183+ LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
184+ GH_ACTION_VERSION : ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.ref_name }}
185+
186+ - name : Run AWS commands
187+ run : |
188+ awslocal s3 mb s3://test-local
189+ awslocal sqs create-queue --queue-name test-queue-local
140190
141191 - name : Save the State Artifact
142192 uses : jenseng/dynamic-uses@8bc24f0360175e710da532c4d19eafdbed489a06 # v1
143193 with :
144194 uses : LocalStack/setup-localstack@${{ env.GH_ACTION_VERSION }}
145195 with : |-
146196 {
147- "state-name": "cloud -pods-test",
197+ "state-name": "local -pods-test",
148198 "state-action": "save",
149199 "state-backend": "local",
150200 }
151201 env :
152202 LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
153203 GH_ACTION_VERSION : ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.ref_name }}
204+
205+ local-state-load-test :
206+ name : ' Test Local State Load Action'
207+ runs-on : ubuntu-latest
208+ steps :
209+ - name : ⚡️ Checkout the repository
210+ uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
211+
212+ - name : Start LocalStack
213+ uses : jenseng/dynamic-uses@8bc24f0360175e710da532c4d19eafdbed489a06 # v1
214+ with :
215+ uses : LocalStack/setup-localstack@${{ env.GH_ACTION_VERSION }}
216+ with : |-
217+ {
218+ "image-tag": "latest",
219+ "install-awslocal": "true",
220+ "configuration": "DEBUG=1",
221+ "use-pro": "true",
222+ "state-name": "local-pods-test",
223+ "state-action": "load",
224+ "state-backend": "local",
225+ }
226+ env :
227+ LOCALSTACK_API_KEY : ${{ secrets.LOCALSTACK_API_KEY }}
228+ GH_ACTION_VERSION : ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
229+
230+ - name : Run AWS Commands
231+ run : |
232+ echo "Verifying S3 bucket..."
233+ awslocal s3 ls | grep "test-local"
234+ echo "Verifying SQS queue..."
235+ awslocal sqs list-queues | grep "test-queue-local"
0 commit comments