Skip to content

Commit

Permalink
test/e2e: add testscript for AtlasMigration resource (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm authored Oct 13, 2024
1 parent 26392d6 commit 4956de5
Show file tree
Hide file tree
Showing 22 changed files with 325 additions and 632 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,3 @@ jobs:
make test-e2e \
ATLAS_TOKEN=${{ secrets.ATLAS_TOKEN }} \
KIND_CLUSTER=chart-testing
e2e-shell:
runs-on: ubuntu-latest
needs: [unit]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Install Atlas CLI
uses: ariga/setup-atlas@master
- uses: azure/setup-kubectl@v4
- name: Start minikube
uses: medyagh/setup-minikube@master
- name: Install Skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v2.3.1/skaffold-linux-amd64 && \
sudo install skaffold /usr/local/bin/
- name: Run integration tests
run: |
make docker-build integration-tests
46 changes: 16 additions & 30 deletions .github/workflows/push-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,23 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: start minikube
id: minikube
uses: medyagh/setup-minikube@master
- uses: azure/setup-helm@v3
- name: install atlas-operator
- uses: actions/checkout@v4
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
- name: Setup Helm
uses: azure/setup-helm@v4
- name: Run e2e tests with Operator
run: |
helm install atlas-operator charts/atlas-operator --wait \
--set image.pullPolicy=Always
- name: apply test resources
run: |
kubectl apply -k config/integration
- name: wait for test resources
run: |
if ! kubectl wait --for=condition=ready --timeout=120s atlasschemas --all; then
kubectl describe atlasschemas
kubectl describe pods -l atlasgo.io/engine=postgres
kubectl describe pods -l atlasgo.io/engine=mysql
kubectl describe deployments
exit 1
fi
make test-e2e \
ATLAS_TOKEN=${{ secrets.ATLAS_TOKEN }} \
KIND_CLUSTER=chart-testing \
TEST_RUN='(schema|migration)-mysql'
env:
HELM_TEST: "true"
- name: test env vars
run: |
kubectl apply -k config/integration/env
helm upgrade atlas-operator charts/atlas-operator -f ./config/integration/env/values.yaml --wait
# Find the operator pod
OPERATOR=$(kubectl get pods -o jsonpath='{.items[0].metadata.name}')
# Extract the env from the operator pod
kubectl exec $OPERATOR -- env | grep NORMAL_ENV
kubectl exec $OPERATOR -- env | grep CONFIGMAP_REF_ENV
kubectl exec $OPERATOR -- env | grep SECRET_REF_ENV
helm template atlas-operator charts/atlas-operator \
--set-json=extraEnvs='[{"name":"NORMAL_ENV","value":"value"}]' | grep NORMAL_ENV
helm-push:
name: Push to ghcr.io
needs: [helm-test]
Expand All @@ -66,8 +52,8 @@ jobs:
run:
working-directory: charts/
steps:
- uses: actions/checkout@v3
- uses: azure/setup-helm@v3
- uses: actions/checkout@v4
- uses: azure/setup-helm@v4
- name: get version
id: version
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ test: manifests generate fmt vet envtest ## Run tests.
# - CERT_MANAGER_INSTALL_SKIP=true
.PHONY: test-e2e
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
go test ./test/e2e/ -v -run=^TestOperator/${TEST_RUN}
go test ./test/e2e/ -v -run="^TestOperator/${TEST_RUN}"

.PHONY: kind-image
kind-image:
Expand Down
66 changes: 0 additions & 66 deletions config/integration/databases/mysql.yaml

This file was deleted.

75 changes: 0 additions & 75 deletions config/integration/databases/postgres.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions config/integration/env/configmap.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions config/integration/env/kustomization.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions config/integration/env/secret.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions config/integration/env/values.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions config/integration/kustomization.yaml

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions config/integration/migration/mysql-migrations/20230316090502.sql

This file was deleted.

3 changes: 0 additions & 3 deletions config/integration/migration/mysql-migrations/atlas.sum

This file was deleted.

Loading

0 comments on commit 4956de5

Please sign in to comment.