Skip to content

Commit 102b1c2

Browse files
committed
add a make run now
1 parent aedbb57 commit 102b1c2

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ jobs:
5555
run: |
5656
make deploy
5757
58+
- name: Run AWS CLI command
59+
run: |
60+
make run
61+
5862
- name: Integration Tests
5963
run: |
60-
npm test
64+
make test
6165
6266
- name: Show Logs
6367
if: always()

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ test: ## Run the tests
4242
npm test
4343
@echo "Tests completed successfully."
4444

45+
run: ## Execute a SQL query through the Lambda function
46+
@echo "Executing SQL query through Lambda function..."
47+
@aws_version=$$(aws --version | grep -o "aws-cli/[0-9]*" | cut -d'/' -f2); \
48+
if [ "$$aws_version" = "2" ]; then \
49+
echo "Using AWS CLI version 2 command format..."; \
50+
awslocal lambda invoke \
51+
--cli-binary-format raw-in-base64-out \
52+
--function-name my-lambda-rds-query-helper \
53+
--payload '{"sqlQuery": "select Author from books", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output; \
54+
else \
55+
echo "Using AWS CLI version 1 command format..."; \
56+
awslocal lambda invoke \
57+
--function-name my-lambda-rds-query-helper \
58+
--payload '{"sqlQuery": "select Author from books", "secretName":"/rdsinitexample/rds/creds/mysql-01"}' output; \
59+
fi
60+
@echo "Query execution completed. Results:"
61+
@cat output
62+
4563
start: ## Start LocalStack in detached mode
4664
@echo "Starting LocalStack..."
4765
@LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d

0 commit comments

Comments
 (0)