Skip to content

fix: Fixes search index acceptance tests flow #1610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
config: ${{ steps.filter.outputs.config }}
assume_role: ${{ steps.filter.outputs.assume_role }}
event_trigger: ${{ steps.filter.outputs.event_trigger }}
search_index: ${{ steps.filter.outputs.search_index }}
steps:
- uses: actions/checkout@v4
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || inputs.parent-event-name == 'release' }}
Expand Down Expand Up @@ -101,13 +102,14 @@ jobs:
- 'mongodbatlas/resource_mongodbatlas_org_invitation*.go'
- 'mongodbatlas/resource_mongodbatlas_organization*.go'
- 'mongodbatlas/resource_mongodbatlas_project_api_key*.go'
- 'mongodbatlas/resource_mongodbatlas_search_index*.go'
- 'mongodbatlas/resource_mongodbatlas_team*.go'
- 'mongodbatlas/resource_mongodbatlas_third_party_integration*.go'
event_trigger:
- 'mongodbatlas/resource_mongodbatlas_event_trigger*.go'
- 'mongodbatlas/data_source_mongodbatlas_event_trigger*.go'

search_index:
- 'mongodbatlas/resource_mongodbatlas_search_index*.go'

cluster_outage_simulation:
needs: [ change-detection ]
if: ${{ needs.change-detection.outputs.cluster_outage_simulation == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'run-testacc' || github.event.label.name == 'run-testacc-cluster-outage-simulation' || inputs.parent-event-name == 'release' }}
Expand Down Expand Up @@ -467,4 +469,31 @@ jobs:
PARALLEL_GO_TEST: 20
CI: true
TEST_REGEX: "^TestAccSTSAssumeRole"
run: make testacc
run: make testacc

search_index:
needs: [ change-detection ]
if: ${{ needs.change-detection.outputs.search_index == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'run-testacc' || github.event.label.name == 'run-testacc-search-index' || inputs.parent-event-name == 'release' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Acceptance Tests
env:
MONGODB_ATLAS_BASE_URL: ${{ vars.MONGODB_ATLAS_BASE_URL }}
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_CLOUD_DEV }}
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY_CLOUD_DEV }}
MONGODB_ATLAS_ORG_ID: ${{ vars.MONGODB_ATLAS_ORG_ID_CLOUD_DEV }}
MONGODB_ATLAS_PROJECT_ID: ${{ vars.MONGODB_ATLAS_ACCTEST_SEARCH_INDEX_PROJECT_ID_CLOUD_DEV }}
SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ vars.SKIP_TEST_EXTERNAL_CREDENTIALS }}
ACCTEST_TIMEOUT: ${{ vars.ACCTEST_TIMEOUT }}
TF_LOG: ${{ vars.LOG_LEVEL }}
TF_ACC: 1
PARALLEL_GO_TEST: 20
TEST_REGEX: "^TestAccSearchIndex"
run: make testacc

4 changes: 2 additions & 2 deletions .github/workflows/cleanup-test-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- cron: "0 3 * * *" # workflow runs every day at 03:00 AM

jobs:
clenup-test-env-general:
cleanup-test-env-general:
runs-on: ubuntu-latest
steps:
- name: setup Atlas CLI
Expand All @@ -29,7 +29,7 @@ jobs:
MONGODB_ATLAS_OPS_MANAGER_URL: ${{vars.MONGODB_ATLAS_BASE_URL}}
PROJECT_TO_NOT_DELETE: ${{vars.MONGODB_ATLAS_ACCTEST_TRIGGER_PROJECT_ID_CLOUD_DEV}}
run: ./scripts/cleanup-test-env.sh
clenup-test-env-network:
cleanup-test-env-network:
runs-on: ubuntu-latest
steps:
- name: Setup Atlas CLI
Expand Down
9 changes: 9 additions & 0 deletions mongodbatlas/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,12 @@ func testCheckPrivateEndpointServiceDataFederationOnlineArchiveRun(tb testing.TB
tb.Skip("`MONGODB_ATLAS_PRIVATE_ENDPOINT_ID` must be set for Private Endpoint Service Data Federation and Online Archive acceptance testing")
}
}

func testAccPreCheckSearchIndex(tb testing.TB) {
if os.Getenv("MONGODB_ATLAS_PUBLIC_KEY") == "" ||
os.Getenv("MONGODB_ATLAS_PRIVATE_KEY") == "" ||
os.Getenv("MONGODB_ATLAS_ORG_ID") == "" ||
os.Getenv("MONGODB_ATLAS_PROJECT_ID") == "" {
tb.Fatal("`MONGODB_ATLAS_PUBLIC_KEY`, `MONGODB_ATLAS_PRIVATE_KEY`, `MONGODB_ATLAS_ORG_ID`, and `MONGODB_ATLAS_PROJECT_ID` must be set for acceptance testing")
}
}
Loading