diff --git a/.github/workflows/plugin-patch.yml b/.github/workflows/plugin-patch.yml index 40f9664..139dc40 100644 --- a/.github/workflows/plugin-patch.yml +++ b/.github/workflows/plugin-patch.yml @@ -3,7 +3,7 @@ on: push name: Plugin Patch Test jobs: - test_plugin_patch: + test_plugin_ec2: runs-on: ubuntu-latest steps: @@ -64,26 +64,99 @@ jobs: fi - name: Run EC2 - Create Instance Tests + run: | + source .venv/bin/activate + + export LOCALSTACK_API_KEY=${{ secrets.LOCALSTACK_API_KEY }} + options="-s -v --ls-start --gather-metrics" + + ec2_test="terraform-provider-aws/internal/service/ec2/ec2_host_data_source_test.go::TestAccEC2HostDataSource_basic terraform-provider-aws/internal/service/ec2/ec2_host_data_source_test.go::TestAccEC2HostDataSource_filter terraform-provider-aws/internal/service/ec2/ec2_host_test.go::TestAccEC2Host_basic terraform-provider-aws/internal/service/ec2/ec2_host_test.go::TestAccEC2Host_disappears terraform-provider-aws/internal/service/ec2/ec2_host_test.go::TestAccEC2Host_instanceFamily terraform-provider-aws/internal/service/ec2/ec2_host_test.go::TestAccEC2Host_tags terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_basic terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_tags terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_azUserData terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_RootBlockDevice_kmsKeyID terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_rootInstanceStore terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_privateIP terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_keyPair terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_vpc terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_placementGroup terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_securityGroups terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_vpcSecurityGroups terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_getUserData terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_GetUserData_noUserData terraform-provider-aws/internal/service/ec2/ec2_instance_data_source_test.go::TestAccEC2InstanceDataSource_timeout" + python -m pytest --junitxml=target/reports/pytest.xml $(python terraform_pytest/get_tf_partitions.py $ec2_test $options + + - name: Archive Test Result + uses: actions/upload-artifact@v3 + if: always() + with: + name: test-metrics + path: target/reports + + - name: Publish ${{ matrix.service }} Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + junit_files: target/reports/*.xml + check_name: ${{ matrix.service }} Terraform Test Results + + test_plugin_rds: + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v3 + with: + submodules: 'true' + + - uses: actions/setup-go@v3 + with: + go-version: '1.20.x' + cache: true + cache-dependency-path: terraform-provider-aws/go.sum + + - name: Set up Python 3.10.5 + uses: actions/setup-python@v4 + with: + python-version: '3.10.5' + cache: 'pip' + + - name: Install system dependencies + run: | + python -m venv .venv + source .venv/bin/activate + pip install --upgrade pip + pip install -r requirements.txt + + - name: Patch Terraform Provider + run: | + source .venv/bin/activate + cd terraform-provider-aws && go mod vendor + cd ../ + python -m terraform_pytest.main patch + + - name: Build RDS Binary + run: | + source .venv/bin/activate + python -m terraform_pytest.main build -s rds + ls -la ./test-bin + + - name: Setup LocalStack env: - SERVICE: ec2 - PARTITION: null - TINYBIRD_URL: https://api.tinybird.co - TINYBIRD_DATASOURCE: localstack_terraform_test_results - TINYBIRD_TOKEN: ${{ secrets.TINYBIRD_TOKEN }} - CI_COMMIT_SHA: ${{ github.sha }} - CI_JOB_ID: ${{ github.job }} - CI_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - CI_JOB_NAME: ${{ github.job }}-${{ matrix.service_partition.service }}-${{ matrix.service_partition.partition }} + LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} + TMP_USER: ${{ secrets.TMP_USER }} + TMP_PW: ${{ secrets.TMP_PW }} run: | source .venv/bin/activate + pip install --pre localstack enable_pro=${{ inputs.enable-pro || 'true' }} - enable_tinybird='false' - if [[ $enable_pro == 'true' ]] + if [[ $enable_pro != 'true' ]] then - export LOCALSTACK_API_KEY=${{ secrets.LOCALSTACK_API_KEY }} + docker pull localstack/localstack + else + docker pull localstack/localstack-pro + localstack auth login -u $TMP_USER -p $TMP_PW # login is currently required + localstack extensions init + localstack extensions install "git+https://github.com/localstack/localstack-moto-test-coverage/#egg=collect-raw-metric-data-extension&subdirectory=collect-raw-metric-data-extension" fi - - python -m pytest --junitxml=target/reports/pytest.xml terraform-provider-aws/internal/service/ec2/ec2_instance_test.go::TestAccEC2Instance_basic -s -v --ls-start --gather-metrics + + - name: Run RDS - Create Instance Tests + run: | + source .venv/bin/activate + + export LOCALSTACK_API_KEY=${{ secrets.LOCALSTACK_API_KEY }} + options="-s -v --ls-start --gather-metrics" + + rds_test="terraform-provider-aws/internal/service/rds/cluster_data_source_test.go::TestAccRDSClusterDataSource_basic terraform-provider-aws/internal/service/rds/cluster_instance_test.go::TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraMySQL1 terraform-provider-aws/internal/service/rds/cluster_instance_test.go::TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraPostgresql terraform-provider-aws/internal/service/rds/cluster_instance_test.go::TestAccRDSClusterInstance_PerformanceInsightsKMSKeyID_auroraMySQL1 terraform-provider-aws/internal/service/rds/cluster_instance_test.go::TestAccRDSClusterInstance_PerformanceInsightsKMSKeyIDAuroraMySQL1_defaultKeyToCustomKey terraform-provider-aws/internal/service/rds/cluster_instance_test.go::TestAccRDSClusterInstance_performanceInsightsRetentionPeriod terraform-provider-aws/internal/service/rds/cluster_instance_test.go::TestAccRDSClusterInstance_PerformanceInsightsKMSKeyID_auroraPostgresql terraform-provider-aws/internal/service/rds/cluster_instance_test.go::TestAccRDSClusterInstance_PerformanceInsightsKMSKeyIDAuroraPostgresql_defaultKeyToCustomKey terraform-provider-aws/internal/service/rds/cluster_test.go::TestAccRDSCluster_disappears terraform-provider-aws/internal/service/rds/cluster_test.go::TestAccRDSCluster_tags terraform-provider-aws/internal/service/rds/cluster_test.go::TestAccRDSCluster_identifierGenerated terraform-provider-aws/internal/service/rds/cluster_test.go::TestAccRDSCluster_identifierPrefix" + + python -m pytest --junitxml=target/reports/pytest.xml $rds_test $options - name: Archive Test Result uses: actions/upload-artifact@v3