Skip to content

Commit

Permalink
drop e2e test case for no base folder
Browse files Browse the repository at this point in the history
  • Loading branch information
neel-astro committed Sep 26, 2024
1 parent 5d4c8eb commit 510ac96
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 88 deletions.
96 changes: 8 additions & 88 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,97 +340,10 @@ jobs:
dag_tarball_version_after: ${{ steps.get-deployment-after.outputs.desired_dag_tarball_version }}
image_version_after: ${{ steps.get-deployment-after.outputs.desired_image_version }}

base-root-folder-test:
name: Base Root Folder Test
runs-on: ubuntu-latest
needs: [infer-deploy, create-test-deployments]
defaults:
run:
working-directory: e2e-setup/astro-project
strategy:
max-parallel: 1
matrix:
deployment_id:
["${{ needs.create-test-deployments.outputs.DEPLOYMENT_ID }}"]
deploy_type: [dags, image-and-dags]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get Astro Environment Info
id: get-astro-env-info
uses: ./.github/workflows/e2e/get_astro_env_info
with:
input_workspace_id: ${{ github.event.inputs.workspace_id }}
input_organization_id: ${{ github.event.inputs.org_id }}
input_astronomer_host: ${{ github.event.inputs.astronomer_host }}
input_astro_api_token: ${{ github.event.inputs.token }}
secret_workspace_id: ${{ secrets.WORKSPACE_ID }}
secret_organization_id: ${{ secrets.ORGANIZATION_ID }}
secret_astronomer_host: ${{ secrets.ASTRONOMER_HOST }}
secret_astro_api_token: ${{ secrets.ASTRO_API_TOKEN }}

- name: Mock git commands
run: |
# if deploy_type is dags, then use dags-deploy-git.sh as mock otherwise use image-deploy-git.sh as mock
if [[ "${{ matrix.deploy_type }}" == "dags" ]]; then
mv ../mocks/dag-deploy-git.sh /usr/local/bin/git
else
mv ../mocks/image-deploy-git.sh /usr/local/bin/git
fi
chmod +x /usr/local/bin/git
- name: Install dependencies
run: |
sudo apt-get install jq
# we need to pre-install the CLI to set the context
curl -sSL https://install.astronomer.io | sudo bash -s
- name: Set CLI context
run: astro context switch ${{ steps.get-astro-env-info.outputs.astronomer_host }}

- name: Get Deployment Info Before Test
id: get-deployment-before
uses: ./.github/workflows/e2e/get_deployment_info
with:
deployment_id: ${{ matrix.deployment_id }}
organization_id: ${{ steps.get-astro-env-info.outputs.organization_id }}
astro_api_token: ${{ steps.get-astro-env-info.outputs.astro_api_token }}
astronomer_host: ${{ steps.get-astro-env-info.outputs.astronomer_host }}

- name: Run Deploy Action
uses: ./
with:
deployment-id: ${{ matrix.deployment_id }}
workspace: ${{ steps.get-astro-env-info.outputs.workspace_id }}
parse: true
action: deploy

- name: Get Deployment Info After Test
id: get-deployment-after
uses: ./.github/workflows/e2e/get_deployment_info
with:
deployment_id: ${{ matrix.deployment_id }}
organization_id: ${{ steps.get-astro-env-info.outputs.organization_id }}
astro_api_token: ${{ steps.get-astro-env-info.outputs.astro_api_token }}
astronomer_host: ${{ steps.get-astro-env-info.outputs.astronomer_host }}

- name: Validate Deploy Action
uses: ./.github/workflows/e2e/validate_deployment
with:
is_dag_only_deploy: ${{ matrix.deploy_type == 'dags' }}
dag_tarball_version_before: ${{ steps.get-deployment-before.outputs.desired_dag_tarball_version }}
image_version_before: ${{ steps.get-deployment-before.outputs.desired_image_version }}
dag_tarball_version_after: ${{ steps.get-deployment-after.outputs.desired_dag_tarball_version }}
image_version_after: ${{ steps.get-deployment-after.outputs.desired_image_version }}

no-deploy-test:
name: No Deploy Test
runs-on: ubuntu-latest
needs: [base-root-folder-test, create-test-deployments]
needs: [infer-deploy, create-test-deployments]
strategy:
matrix:
deployment_id:
Expand Down Expand Up @@ -464,6 +377,13 @@ jobs:
- name: Set CLI context
run: astro context switch ${{ steps.get-astro-env-info.outputs.astronomer_host }}

- name: Mock git commands for DAG Deploy
run: |
# set to no deploy git mock, to simulate no interested file change scenario
mv e2e-setup/mocks/no-deploy-git.sh /usr/local/bin/git
chmod +x /usr/local/bin/git
- name: Get Deployment Info Before Test
id: get-deployment-before
if: ${{ matrix.deploy_type != 'dbt' }}
Expand Down
13 changes: 13 additions & 0 deletions e2e-setup/mocks/no-deploy-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# hack to mock git commands as part of action.yaml so that we could simulate no deploy scenario without making any additional commits

# Check if the script was invoked with "git diff"
if [[ "$1" == "diff" ]]; then
echo "README.md"
elif [[ "$1" == "fetch" ]]; then
echo "Handling git fetch, doing nothing"
else
echo "Error: git mock script isn't configured to handle $1" >&2
exit 1
fi

0 comments on commit 510ac96

Please sign in to comment.