diff --git a/.github/workflows/integration-self-hosted.yml b/.github/workflows/integration-self-hosted.yml new file mode 100644 index 00000000..d85ac0cc --- /dev/null +++ b/.github/workflows/integration-self-hosted.yml @@ -0,0 +1,38 @@ +name: integration +on: + pull_request: + paths: + - pkg/** + - integration/self_hosted/** + - main.go + - go.mod + schedule: + - cron: 1 11 * * 0 + +jobs: + self-hosted: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Docker Compose Up + run: docker compose up --build -d materialized materialized_init redpanda postgres localstack mysql provider + + - name: Terraform Init + run: | + docker exec provider sh -c "cd self_hosted && terraform init" + + - name: Terraform Apply + run: | + docker exec provider sh -c "cd self_hosted && terraform apply -auto-approve -compact-warnings" + + - name: Terraform Plan + run: | + docker exec provider sh -c "cd self_hosted && terraform plan -detailed-exitcode" + + - name: Terraform Destroy + run: | + docker exec provider sh -c "cd self_hosted && terraform destroy -auto-approve -compact-warnings" + + - name: Docker Compose Down + run: docker compose down diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 85f4cc42..146aa912 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -10,7 +10,7 @@ on: - cron: 1 11 * * 0 jobs: - integration: + saas: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 102b9b02..ac544202 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,14 +61,20 @@ make testacc To run the full integration project, set the necessary env variables and start the docker compose similar to the acceptance tests. Then to interact with the provider you can run: ```bash -# Run the tests +# SaaS tests docker exec provider terraform init docker exec provider terraform apply -auto-approve -compact-warnings docker exec provider terraform plan -detailed-exitcode docker exec provider terraform destroy -auto-approve -compact-warnings + +# Self-hosted tests +docker exec provider sh -c "cd /usr/src/app/integration/self_hosted && terraform init" +docker exec provider sh -c "cd /usr/src/app/integration/self_hosted && terraform apply -auto-approve -compact-warnings" +docker exec provider sh -c "cd /usr/src/app/integration/self_hosted && terraform plan -detailed-exitcode" +docker exec provider sh -c "cd /usr/src/app/integration/self_hosted && terraform destroy -auto-approve -compact-warnings" ``` -> Note: You might have to delete the `integration/.terraform`, `integration/.terraform.lock.hcl` and `integration/terraform.tfstate*` files before running the tests. +> Note: You might have to delete the `integration/.terraform`, `integration/.terraform.lock.hcl` and `integration/terraform.tfstate*` files before running the tests. Or if you are running the self-hosted tests, you will have to delete the `integration/self_hosted/.terraform`, `integration/self_hosted/.terraform.lock.hcl` and `integration/self_hosted/terraform.tfstate*` files. ### Debugging Terraform has detailed logs that you can enable by setting the `TF_LOG` environment variable to any value. Enabling this setting causes detailed logs to appear on `stderr`. diff --git a/DESIGN.md b/DESIGN.md index 3c9bc479..3178edde 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -58,4 +58,4 @@ Being the most lightweight the unit tests should cover the wide of SQL variation **Acceptance tests** use the Terraform `acctest` package to execute Terraform commands in a certain order. These tests are used to ensure the applys, updates and destroys work as expected for each resource. These tests should not cover every SQL permutation but ensure that high level Terraform commands execute against the Materialize image. These tests rely on the docker compose. -**Integration tests** consist of an entire Terraform package in the `integration` directory. This will spin up a docker compose using the `materialized` and surrounding kafka and database dependencies. All resources are applied and destroyed as part of the same terraform project. Any new resources or permutations should be added to the integration tests. \ No newline at end of file +**Integration tests** consist of an entire Terraform package in the `integration` directory. This will spin up a docker compose using the `materialized` and surrounding kafka and database dependencies. All resources are applied and destroyed as part of the same terraform project. Any new resources or permutations should be added to the integration tests.