diff --git a/.env b/.env index 00993d71..ce0fbbe7 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ # Customize these values as needed for testing both local and on github # Handlers to build -HANDLERS_TO_BUILD=basic-lambda +HANDLERS_TO_BUILD="basic-lambda basic-sqs http-basic-lambda" HANDLER=basic-lambda diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100755 index 00000000..ae40a9f1 --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,25 @@ +#!/bin/sh +# Pre-commit hook to run cargo fmt +# +# To install this hook, run: +# cp scripts/pre-commit .git/hooks/pre-commit +# chmod +x .git/hooks/pre-commit + +echo "Running cargo fmt..." + +# Run cargo fmt on the entire workspace +cargo fmt --all -- --check + +# Check if cargo fmt found any formatting issues +if [ $? -ne 0 ]; then + echo "" + echo "❌ Code formatting issues detected!" + echo "Running 'cargo fmt --all' to fix formatting..." + cargo fmt --all + echo "" + echo "✅ Formatting applied. Please review the changes and commit again." + exit 1 +fi + +echo "✅ Code formatting is correct!" +exit 0 diff --git a/test/dockerized/suites/core.json b/test/dockerized/suites/core.json index 5a21d066..d5d56ce7 100644 --- a/test/dockerized/suites/core.json +++ b/test/dockerized/suites/core.json @@ -14,6 +14,77 @@ "transform": "{msg: .msg}" } ] + }, + { + "name": "test_basic_sqs", + "handler": "basic-sqs", + "request": { + "Records": [ + { + "messageId": "msg-001", + "receiptHandle": "receipt-001", + "body": "{\"id\":\"user-123\",\"text\":\"Hello from SQS\"}", + "attributes": { + "ApproximateReceiveCount": "1", + "SentTimestamp": "1234567890", + "SenderId": "AIDAI123456789", + "ApproximateFirstReceiveTimestamp": "1234567890" + }, + "messageAttributes": {}, + "md5OfBody": "abc123", + "eventSource": "aws:sqs", + "eventSourceARN": "arn:aws:sqs:us-east-1:123456789012:test-queue", + "awsRegion": "us-east-1" + } + ] + }, + "assertions": [ + { + "response": null + } + ] + }, + { + "name": "test_http_basic_lambda", + "handler": "http-basic-lambda", + "request": { + "version": "2.0", + "routeKey": "$default", + "rawPath": "/", + "rawQueryString": "", + "headers": { + "accept": "text/html", + "user-agent": "test-client" + }, + "requestContext": { + "accountId": "123456789012", + "apiId": "api-id", + "domainName": "example.com", + "domainPrefix": "api", + "http": { + "method": "GET", + "path": "/", + "protocol": "HTTP/1.1", + "sourceIp": "127.0.0.1", + "userAgent": "test-client" + }, + "requestId": "req-001", + "routeKey": "$default", + "stage": "$default", + "time": "01/Jan/2024:00:00:00 +0000", + "timeEpoch": 1704067200000 + }, + "isBase64Encoded": false + }, + "assertions": [ + { + "response": { + "statusCode": 200, + "body": "Hello AWS Lambda HTTP request" + }, + "transform": "{statusCode: .statusCode, body: .body}" + } + ] } ] }