Skip to content

chore: add missing tests to snapshots #34

chore: add missing tests to snapshots

chore: add missing tests to snapshots #34

---
name: Update E2E Tests Snapshots
on:
workflow_dispatch:
schedule:
- cron: 0 5 * * 1-5 # weekdays at 5:00 AM UTC
pull_request:
types: [labeled]
jobs:
update-tests:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || (github.event.action == 'labeled' && github.event.label.name == 'update-snapshots')
strategy:
fail-fast: false
matrix:
tags:
- atlas,autogeneration
- atlas,backup,compliancepolicy
- atlas,backup,flex
- atlas,backup,exports,buckets
- atlas,backup,exports,jobs
- atlas,backup,restores
- atlas,backup,schedule
- atlas,backup,snapshot
- atlas,clusters,file
- atlas,clusters,flags
- atlas,clusters,flex
- atlas,clusters,m0
- atlas,clusters,sharded
- atlas,clusters,upgrade
- atlas,datafederation,db
- atlas,datafederation,privatenetwork
- atlas,datafederation,querylimits
# - atlas,decrypt # requires live calls to GCP/AWS/Azure
# - atlas,deployments,atlasclusters # one assertion connects to DB (needs live mode)
# - atlas,deployments,local,auth,deprecated # needs docker to run
# - atlas,deployments,local,auth,new # needs docker to run
# - atlas,deployments,local,nocli # needs docker to run
# - atlas,deployments,local,noauth # needs docker to run
# - atlas,generic # tests are failing in master
- atlas,interactive
- atlas,ldap
- atlas,livemigrations
- atlas,logs
- atlas,metrics
- atlas,networking
- atlas,onlinearchive
- atlas,performanceAdvisor
- atlas,plugin,install
- atlas,plugin,run
- atlas,plugin,uninstall
- atlas,plugin,update
- atlas,processes
- atlas,search
- atlas,search_nodes
- atlas,serverless,instance
- atlas,streams
- atlas,streams_with_cluster
- brew
- config
- atlas,iam
- kubernetes
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go install gotest.tools/gotestsum@latest
- name: write config file
run: |
set -Eeou pipefail
mkdir "$XDG_CONFIG_HOME/atlascli"
cat <<EOF > "$XDG_CONFIG_HOME/atlascli/config.toml"
[e2e]
org_id = "test_id"
public_api_key = "test_pub"
service = "cloud"
EOF
- run: rm -rf test/e2e/.snapshots
- run: make e2e-test
env:
TEST_CMD: gotestsum --junitfile e2e-tests.xml --format standard-verbose --
E2E_TAGS: ${{ matrix.tags }}
MONGODB_ATLAS_ORG_ID: ${{ secrets.MONGODB_ATLAS_ORG_ID }}
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.MONGODB_ATLAS_PROJECT_ID }}
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_API_KEY }}
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_API_KEY }}
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ secrets.MONGODB_ATLAS_OPS_MANAGER_URL }}
MONGODB_ATLAS_SERVICE: cloud
DO_NOT_TRACK: 1
UPDATE_SNAPSHOTS: true
E2E_SKIP_CLEANUP: true
E2E_CLOUD_ROLE_ID: ${{ secrets.E2E_CLOUD_ROLE_ID }}
E2E_TEST_BUCKET: ${{ secrets.E2E_TEST_BUCKET }}
E2E_FLEX_INSTANCE_NAME: ${{ secrets.E2E_FLEX_INSTANCE_NAME }}
IDENTITY_PROVIDER_ID: ${{ secrets.IDENTITY_PROVIDER_ID }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
E2E_TIMEOUT: 3h
- name: set artifact name
if: always()
run: |
echo "NAME=snapshots_${{ matrix.tags }}" | sed "s|,|_|g" >> "$GITHUB_ENV"
- name: upload artifact
if: always()
uses: actions/upload-artifact@v4.6.2
with:
name: ${{ env.NAME }}
path: test/e2e/.snapshots
include-hidden-files: true
- name: Test Summary
if: always()
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
with:
paths: e2e-tests.xml
cleanup:
if: always()
needs: update-tests
runs-on: ubuntu-latest
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
with:
config: ${{ vars.PERMISSIONS_CONFIG }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go install gotest.tools/gotestsum@latest
- run: make e2e-test
env:
TEST_CMD: gotestsum --junitfile e2e-tests.xml --format standard-verbose --
E2E_TAGS: atlas,cleanup
MONGODB_ATLAS_ORG_ID: ${{ secrets.MONGODB_ATLAS_ORG_ID }}
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.MONGODB_ATLAS_PROJECT_ID }}
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_API_KEY }}
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_API_KEY }}
MONGODB_ATLAS_OPS_MANAGER_URL: ${{ secrets.MONGODB_ATLAS_OPS_MANAGER_URL }}
MONGODB_ATLAS_SERVICE: cloud
DO_NOT_TRACK: 1
E2E_CLOUD_ROLE_ID: ${{ secrets.E2E_CLOUD_ROLE_ID }}
E2E_TEST_BUCKET: ${{ secrets.E2E_TEST_BUCKET }}
E2E_FLEX_INSTANCE_NAME: ${{ secrets.E2E_FLEX_INSTANCE_NAME }}
IDENTITY_PROVIDER_ID: ${{ secrets.IDENTITY_PROVIDER_ID }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
E2E_TIMEOUT: 3h
- name: Test Summary
if: always()
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
with:
paths: e2e-tests.xml
commit:
runs-on: ubuntu-latest
if: always() && github.event_name == 'pull_request'
needs: update-tests
steps:
- name: set Apix Bot token
id: app-token
uses: mongodb/apix-action/token@dd1d8b713effb9ac4972a3318b8e2f03b8a6d8ce
with:
app-id: ${{ secrets.APIXBOT_APP_ID }}
private-key: ${{ secrets.APIXBOT_APP_PEM }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.event.pull_request.head.ref }}
- run: rm -rf test/e2e/.snapshots && mkdir -p test/e2e/.snapshots
- name: Download artifacts
uses: actions/download-artifact@v4.2.1
with:
pattern: snapshots_*
path: test/e2e/.snapshots
merge-multiple: true
- name: commit
run: |
git config --global user.name "${{ steps.app-token.outputs.user-name }}"
git config --global user.email "${{ steps.app-token.outputs.user-email }}"
git add test/e2e/.snapshots
git commit -m "Update snapshots"
git push
- uses: actions-ecosystem/action-remove-labels@v1
with:
github_token: ${{ steps.app-token.outputs.token }}
labels: update-snapshots
pr:
runs-on: ubuntu-latest
if: always() && github.event_name != 'pull_request'
needs: update-tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: rm -rf test/e2e/.snapshots && mkdir -p test/e2e/.snapshots
- name: Download artifacts
uses: actions/download-artifact@v4.2.1
with:
pattern: snapshots_*
path: test/e2e/.snapshots
merge-multiple: true
- name: Find JIRA ticket
id: find
uses: mongodb/apix-action/find-jira@dd1d8b713effb9ac4972a3318b8e2f03b8a6d8ce
with:
token: ${{ secrets.JIRA_API_TOKEN }}
jql: project = CLOUDP AND status NOT IN (Closed, Resolved) AND summary ~ "Update Test Snapshots"
- name: Set JIRA ticket (find)
if: steps.find.outputs.found == 'true'
run: |
echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV"
- name: Create JIRA ticket
uses: mongodb/apix-action/create-jira@dd1d8b713effb9ac4972a3318b8e2f03b8a6d8ce
id: create
if: steps.find.outputs.found == 'false'
with:
token: ${{ secrets.JIRA_API_TOKEN }}
project-key: CLOUDP
summary: "[AtlasCLI] Update Test Snapshots"
issuetype: Story
description: Update Test Snapshots
components: AtlasCLI
assignee: ${{ secrets.ASSIGNEE_JIRA_TICKET }}
extra-data: |
{
"fields": {
"fixVersions": [
{
"id": "41805"
}
],
"customfield_12751": [
{
"id": "22223"
}
],
"customfield_10257": {
"id": "11861"
}
}
}
- name: Set JIRA ticket (create)
if: steps.find.outputs.found == 'false'
run: |
echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV"
- name: set Apix Bot token
id: app-token
uses: mongodb/apix-action/token@dd1d8b713effb9ac4972a3318b8e2f03b8a6d8ce
with:
app-id: ${{ secrets.APIXBOT_APP_ID }}
private-key: ${{ secrets.APIXBOT_APP_PEM }}
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
id: pr
with:
token: ${{ steps.app-token.outputs.token }}
title: "${{ env.JIRA_KEY }}: Update Test Snapshots"
commit-message: "${{ env.JIRA_KEY }}: Update Test Snapshots"
delete-branch: true
base: master
branch: ${{ env.JIRA_KEY }}
labels: |
auto_close_jira
body: |
## Proposed changes
Update Test Snapshots
_Jira ticket:_ ${{ env.JIRA_KEY }}
Note: Jira ticket will be closed automatically when this PR is merged.
- name: Set auto merge
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh pr merge "${{ steps.pr.outputs.pull-request-url }}" --auto --squash