-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQS: Ensure all SQS responses are in JSON format (#7057)
- Loading branch information
Showing
8 changed files
with
98 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Ruby SDK test | ||
on: [workflow_call] | ||
|
||
jobs: | ||
test: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
ruby-version: ['3.2'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Ruby ${{ matrix.ruby-version }} | ||
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Start MotoServer | ||
run: | | ||
pip install build | ||
python -m build | ||
docker run --rm -t --name motoserver -e TEST_SERVER_MODE=true -e AWS_SECRET_ACCESS_KEY=server_secret -e AWS_ACCESS_KEY_ID=server_key -v `pwd`:/moto -p 5000:5000 -v /var/run/docker.sock:/var/run/docker.sock python:3.10-slim /moto/scripts/ci_moto_server.sh & | ||
python scripts/ci_wait_for_server.py | ||
- name: Install dependencies | ||
run: cd other_langs/tests_ruby && bundle install | ||
- name: Run tests | ||
env: | ||
AWS_ENDPOINT_URL: "http://localhost:5000" | ||
run: | | ||
mkdir ~/.aws && touch ~/.aws/credentials && echo -e "[default]\naws_access_key_id = test\naws_secret_access_key = test" > ~/.aws/credentials | ||
cd other_langs/tests_ruby && ruby test/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "https://rubygems.org" | ||
|
||
gem 'aws-sdk-sqs', '1.65.0' | ||
gem "minitest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'aws-sdk-sqs' | ||
require 'minitest/autorun' | ||
|
||
class AwsSqsTest < Minitest::Test | ||
def test_all_sqs_actions | ||
region = 'us-east-1' | ||
|
||
sqs_client = Aws::SQS::Client.new(region: region) | ||
|
||
sqs_client.list_queues | ||
|
||
sqs_client.create_queue(queue_name: "q1") | ||
|
||
sqs_client.list_queues | ||
|
||
queue_url = sqs_client.get_queue_url(queue_name: "q1").queue_url | ||
|
||
sqs_client.add_permission({queue_url: queue_url, label: "String", aws_account_ids: ["String"], actions: ["GetQueueUrl"]}) | ||
|
||
sqs_client.send_message( | ||
queue_url: queue_url, | ||
message_body: "message_body" | ||
) | ||
|
||
sqs_client.remove_permission({queue_url: queue_url, label: "String"}) | ||
|
||
sqs_client.set_queue_attributes({queue_url: queue_url, attributes: {"All" => "DelaySeconds"}}) | ||
|
||
sqs_client.receive_message( | ||
queue_url: queue_url, | ||
max_number_of_messages: 10, | ||
attribute_names: ['All'], | ||
message_attribute_names: ['All'] | ||
).messages | ||
|
||
sqs_client.purge_queue({queue_url: queue_url}) | ||
|
||
sqs_client.delete_queue(queue_url: queue_url) | ||
end | ||
end |