From 651722689ff607b37085a505edc2372901e71483 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Sun, 26 Feb 2023 18:44:04 -0100 Subject: [PATCH] Admin: Improve automatic resource updates (#5988) --- .../data-update_ec2-instance-offerings.yml | 5 ++--- .../data-update_ec2-instance-types.yml | 5 ++--- .../data-update_ssm-default-amis.yml | 8 +++----- .../data-update_ssm-default-parameters.yml | 5 ++--- tests/test_acm/test_acm.py | 16 +++++++-------- .../test_cloudwatch_dashboards.py | 2 +- tests/test_polly/test_polly.py | 20 +++++++++---------- tests/test_sqs/test_sqs.py | 4 ++-- tests/test_ssm/test_ssm_boto3.py | 2 +- 9 files changed, 31 insertions(+), 36 deletions(-) diff --git a/.github/workflows/data-update_ec2-instance-offerings.yml b/.github/workflows/data-update_ec2-instance-offerings.yml index 1b3ebfc17..39b749aba 100644 --- a/.github/workflows/data-update_ec2-instance-offerings.yml +++ b/.github/workflows/data-update_ec2-instance-offerings.yml @@ -9,7 +9,7 @@ name: "DataUpdate_EC2InstanceOfferings" on: schedule: - - cron: '00 12 * * 0' + - cron: '00 6 * * 0' workflow_dispatch: jobs: @@ -40,12 +40,11 @@ jobs: - name: Pull EC2 instance types from AWS uses: technote-space/create-pr-action@v2 with: - GITHUB_TOKEN: ${{ secrets.PR_ACCESS_TOKEN }} EXECUTE_COMMANDS: | pip install boto3 scripts/ec2_get_instance_type_offerings.py COMMIT_MESSAGE: 'chore: update EC2 Instance Offerings' COMMIT_NAME: 'Moto Admin' COMMIT_EMAIL: 'admin@getmoto.org' - PR_BRANCH_NAME: 'chore-update-ec2-offerings-${PR_ID}' + PR_BRANCH_NAME: 'chore-update-ec2-offerings-${{ github.run_number }}' PR_TITLE: 'chore: update EC2 Instance Offerings' diff --git a/.github/workflows/data-update_ec2-instance-types.yml b/.github/workflows/data-update_ec2-instance-types.yml index e49bf1be1..2c1750649 100644 --- a/.github/workflows/data-update_ec2-instance-types.yml +++ b/.github/workflows/data-update_ec2-instance-types.yml @@ -9,7 +9,7 @@ name: "DataUpdate_EC2InstanceTypes" on: schedule: - - cron: '00 12 * * 0' + - cron: '00 8 * * 0' jobs: update: @@ -39,12 +39,11 @@ jobs: - name: Pull EC2 instance types from AWS uses: technote-space/create-pr-action@v2 with: - # GITHUB_TOKEN: ${{ secrets.PR_ACCESS_TOKEN }} EXECUTE_COMMANDS: | pip install boto3 scripts/get_instance_info.py COMMIT_MESSAGE: 'chore: update EC2 Instance Types' COMMIT_NAME: 'Moto Admin' COMMIT_EMAIL: 'admin@getmoto.org' - PR_BRANCH_NAME: 'chore-update-ec2-types-${PR_ID}' + PR_BRANCH_NAME: 'chore-update-ec2-types-${{ github.run_number }}' PR_TITLE: 'chore: update EC2 Instance Types' diff --git a/.github/workflows/data-update_ssm-default-amis.yml b/.github/workflows/data-update_ssm-default-amis.yml index a84a5d4d6..d4553b212 100644 --- a/.github/workflows/data-update_ssm-default-amis.yml +++ b/.github/workflows/data-update_ssm-default-amis.yml @@ -9,8 +9,7 @@ name: "DataUpdate_SSMdefaultAMIs" on: schedule: - - cron: '00 12 * * 0' - workflow_dispatch: + - cron: '00 10 * * 0' jobs: update: @@ -40,13 +39,12 @@ jobs: - name: Pull SSM default AMIs from AWS uses: technote-space/create-pr-action@v2 with: - GITHUB_TOKEN: ${{ secrets.PR_ACCESS_TOKEN }} EXECUTE_COMMANDS: | pip install boto3 - pip install moto + pip install moto[all] python scripts/ssm_get_default_amis.py COMMIT_MESSAGE: "chore: update SSM default AMI's" COMMIT_NAME: 'Moto Admin' COMMIT_EMAIL: 'admin@getmoto.org' - PR_BRANCH_NAME: 'chore-update-ssm-amis-${PR_ID}' + PR_BRANCH_NAME: 'chore-update-ssm-amis-${{ github.run_number }}' PR_TITLE: "chore: update SSM Instance AMI's" diff --git a/.github/workflows/data-update_ssm-default-parameters.yml b/.github/workflows/data-update_ssm-default-parameters.yml index 06451ef8c..f3f613cd0 100644 --- a/.github/workflows/data-update_ssm-default-parameters.yml +++ b/.github/workflows/data-update_ssm-default-parameters.yml @@ -40,13 +40,12 @@ jobs: - name: Pull SSM default Parameters from AWS uses: technote-space/create-pr-action@v2 with: - GITHUB_TOKEN: ${{ secrets.PR_ACCESS_TOKEN }} EXECUTE_COMMANDS: | pip install boto3 - pip install moto + pip install moto[all] python scripts/ssm_get_default_params.py COMMIT_MESSAGE: "chore: update SSM default parameters" COMMIT_NAME: 'Moto Admin' COMMIT_EMAIL: 'admin@getmoto.org' - PR_BRANCH_NAME: 'chore-update-ssm-params-${PR_ID}' + PR_BRANCH_NAME: 'chore-update-ssm-params-${{ github.run_number }}' PR_TITLE: "chore: update SSM Instance parameters" diff --git a/tests/test_acm/test_acm.py b/tests/test_acm/test_acm.py index da85b8f69..f6f58303d 100644 --- a/tests/test_acm/test_acm.py +++ b/tests/test_acm/test_acm.py @@ -85,7 +85,7 @@ def test_import_bad_certificate(): except ClientError as err: err.response["Error"]["Code"].should.equal("ValidationException") else: - raise RuntimeError("Should of raised ValidationException") + raise RuntimeError("Should have raised ValidationException") @mock_acm @@ -132,7 +132,7 @@ def test_get_invalid_certificate(): except ClientError as err: err.response["Error"]["Code"].should.equal("ResourceNotFoundException") else: - raise RuntimeError("Should of raised ResourceNotFoundException") + raise RuntimeError("Should have raised ResourceNotFoundException") # Also tests deleting invalid certificate @@ -149,7 +149,7 @@ def test_delete_certificate(): except ClientError as err: err.response["Error"]["Code"].should.equal("ResourceNotFoundException") else: - raise RuntimeError("Should of raised ResourceNotFoundException") + raise RuntimeError("Should have raised ResourceNotFoundException") @mock_acm @@ -252,7 +252,7 @@ def test_add_tags_to_invalid_certificate(): except ClientError as err: err.response["Error"]["Code"].should.equal("ResourceNotFoundException") else: - raise RuntimeError("Should of raised ResourceNotFoundException") + raise RuntimeError("Should have raised ResourceNotFoundException") @mock_acm @@ -264,7 +264,7 @@ def test_list_tags_for_invalid_certificate(): except ClientError as err: err.response["Error"]["Code"].should.equal("ResourceNotFoundException") else: - raise RuntimeError("Should of raised ResourceNotFoundException") + raise RuntimeError("Should have raised ResourceNotFoundException") @mock_acm @@ -313,7 +313,7 @@ def test_remove_tags_from_invalid_certificate(): except ClientError as err: err.response["Error"]["Code"].should.equal("ResourceNotFoundException") else: - raise RuntimeError("Should of raised ResourceNotFoundException") + raise RuntimeError("Should have raised ResourceNotFoundException") @mock_acm @@ -343,7 +343,7 @@ def test_resend_validation_email_invalid(): "InvalidDomainValidationOptionsException" ) else: - raise RuntimeError("Should of raised InvalidDomainValidationOptionsException") + raise RuntimeError("Should have raised InvalidDomainValidationOptionsException") try: client.resend_validation_email( @@ -354,7 +354,7 @@ def test_resend_validation_email_invalid(): except ClientError as err: err.response["Error"]["Code"].should.equal("ResourceNotFoundException") else: - raise RuntimeError("Should of raised ResourceNotFoundException") + raise RuntimeError("Should have raised ResourceNotFoundException") @mock_acm diff --git a/tests/test_cloudwatch/test_cloudwatch_dashboards.py b/tests/test_cloudwatch/test_cloudwatch_dashboards.py index 67bcd43f9..bc5dc90f4 100644 --- a/tests/test_cloudwatch/test_cloudwatch_dashboards.py +++ b/tests/test_cloudwatch/test_cloudwatch_dashboards.py @@ -55,7 +55,7 @@ def test_delete_dashboard_fail(): except ClientError as err: err.response["Error"]["Code"].should.equal("ResourceNotFound") else: - raise RuntimeError("Should of raised error") + raise RuntimeError("Should have raised error") resp = client.list_dashboards() len(resp["DashboardEntries"]).should.equal(3) diff --git a/tests/test_polly/test_polly.py b/tests/test_polly/test_polly.py index ecde12bc7..0a48d1aba 100644 --- a/tests/test_polly/test_polly.py +++ b/tests/test_polly/test_polly.py @@ -36,7 +36,7 @@ def test_describe_voices(): except ClientError as err: err.response["Error"]["Code"].should.equal("400") else: - raise RuntimeError("Should of raised an exception") + raise RuntimeError("Should have raised an exception") @mock_polly @@ -71,7 +71,7 @@ def test_put_lexicon_bad_name(): except ClientError as err: err.response["Error"]["Code"].should.equal("InvalidParameterValue") else: - raise RuntimeError("Should of raised an exception") + raise RuntimeError("Should have raised an exception") @mock_polly @@ -111,7 +111,7 @@ def test_synthesize_speech_bad_lexicon(): except ClientError as err: err.response["Error"]["Code"].should.equal("LexiconNotFoundException") else: - raise RuntimeError("Should of raised LexiconNotFoundException") + raise RuntimeError("Should have raised LexiconNotFoundException") @mock_polly @@ -131,7 +131,7 @@ def test_synthesize_speech_bad_output_format(): except ClientError as err: err.response["Error"]["Code"].should.equal("InvalidParameterValue") else: - raise RuntimeError("Should of raised ") + raise RuntimeError("Should have raised ") @mock_polly @@ -151,7 +151,7 @@ def test_synthesize_speech_bad_sample_rate(): except ClientError as err: err.response["Error"]["Code"].should.equal("InvalidSampleRateException") else: - raise RuntimeError("Should of raised ") + raise RuntimeError("Should have raised ") @mock_polly @@ -171,7 +171,7 @@ def test_synthesize_speech_bad_text_type(): except ClientError as err: err.response["Error"]["Code"].should.equal("InvalidParameterValue") else: - raise RuntimeError("Should of raised ") + raise RuntimeError("Should have raised ") @mock_polly @@ -191,7 +191,7 @@ def test_synthesize_speech_bad_voice_id(): except ClientError as err: err.response["Error"]["Code"].should.equal("InvalidParameterValue") else: - raise RuntimeError("Should of raised ") + raise RuntimeError("Should have raised ") @mock_polly @@ -211,7 +211,7 @@ def test_synthesize_speech_text_too_long(): except ClientError as err: err.response["Error"]["Code"].should.equal("TextLengthExceededException") else: - raise RuntimeError("Should of raised ") + raise RuntimeError("Should have raised ") @mock_polly @@ -234,7 +234,7 @@ def test_synthesize_speech_bad_speech_marks1(): "MarksNotSupportedForFormatException" ) else: - raise RuntimeError("Should of raised ") + raise RuntimeError("Should have raised ") @mock_polly @@ -257,4 +257,4 @@ def test_synthesize_speech_bad_speech_marks2(): "MarksNotSupportedForFormatException" ) else: - raise RuntimeError("Should of raised ") + raise RuntimeError("Should have raised ") diff --git a/tests/test_sqs/test_sqs.py b/tests/test_sqs/test_sqs.py index a63ffaadb..72f167e73 100644 --- a/tests/test_sqs/test_sqs.py +++ b/tests/test_sqs/test_sqs.py @@ -56,7 +56,7 @@ def test_create_fifo_queue_fail(): except botocore.exceptions.ClientError as err: err.response["Error"]["Code"].should.equal("InvalidParameterValue") else: - raise RuntimeError("Should of raised InvalidParameterValue Exception") + raise RuntimeError("Should have raised InvalidParameterValue Exception") @mock_sqs @@ -96,7 +96,7 @@ def test_create_queue_with_different_attributes_fail(): except botocore.exceptions.ClientError as err: err.response["Error"]["Code"].should.equal("QueueAlreadyExists") else: - raise RuntimeError("Should of raised QueueAlreadyExists Exception") + raise RuntimeError("Should have raised QueueAlreadyExists Exception") q_name2 = str(uuid4())[0:6] response = sqs.create_queue(QueueName=q_name2, Attributes={"FifoQueue": "tru"}) diff --git a/tests/test_ssm/test_ssm_boto3.py b/tests/test_ssm/test_ssm_boto3.py index 4a6fa984e..fda67a08a 100644 --- a/tests/test_ssm/test_ssm_boto3.py +++ b/tests/test_ssm/test_ssm_boto3.py @@ -546,7 +546,7 @@ def test_get_nonexistant_parameter(): try: client.get_parameter(Name="test_noexist", WithDecryption=False) - raise RuntimeError("Should of failed") + raise RuntimeError("Should have failed") except botocore.exceptions.ClientError as err: err.operation_name.should.equal("GetParameter") err.response["Error"]["Message"].should.equal(