From 2eef7685d2df27c4069845a718b5df5ad556b81e Mon Sep 17 00:00:00 2001 From: Justin Brooks Date: Tue, 28 May 2024 21:59:00 -0400 Subject: [PATCH] init testing (#125) * init testing * set branch --- .github/workflows/handler-test.yml | 13 ++++++++ tests/public-dns/README.md | 11 +++++++ tests/public-dns/main.tf | 52 ++++++++++++++++++++++++++++++ tests/public-dns/versions.tf | 11 +++++++ 4 files changed, 87 insertions(+) create mode 100644 tests/public-dns/README.md create mode 100644 tests/public-dns/main.tf create mode 100644 tests/public-dns/versions.tf diff --git a/.github/workflows/handler-test.yml b/.github/workflows/handler-test.yml index 7850604c..d18b6f42 100644 --- a/.github/workflows/handler-test.yml +++ b/.github/workflows/handler-test.yml @@ -7,15 +7,24 @@ on: env: GOOGLE_SERVICE_ACCOUNT: "terraform-google-testing@playground-111.iam.gserviceaccount.com" + TFE_TOKEN: ${{ secrets.TFE_TOKEN }} jobs: public-dns-with-cloud-dns: name: Public DNS with Cloud DNS runs-on: ubuntu-latest + defaults: + run: + working-directory: ./tests/public-dns + steps: - name: Checkout code uses: actions/checkout@v2 + with: + repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} + ref: ${{ github.event.client_payload.pull_request.head.sha }} + persist-credentials: false - name: Setup Terraform uses: hashicorp/setup-terraform@v1 @@ -48,6 +57,10 @@ jobs: id: validate run: terraform validate -no-color + - name: Terraform Apply + id: apply + run: terraform apply -auto-approve -input=false -no-color + - name: Retrieve Health Check URL id: retrieve-health-check-url run: | diff --git a/tests/public-dns/README.md b/tests/public-dns/README.md new file mode 100644 index 00000000..5353253d --- /dev/null +++ b/tests/public-dns/README.md @@ -0,0 +1,11 @@ +# TEST: Public DNS deployment of W&B + +## About This Test + +## Prerequisites + +## How This Test Is Used + +This test is leveraged by this repository's continuous integration setup which +leverages workspaces in a Terraform Cloud workspaces as a remote backend so that +Terraform state is preserved. diff --git a/tests/public-dns/main.tf b/tests/public-dns/main.tf new file mode 100644 index 00000000..8233b7a1 --- /dev/null +++ b/tests/public-dns/main.tf @@ -0,0 +1,52 @@ +provider "google" { + default_labels = local.labels +} + +provider "google-beta" { + default_labels = local.labels +} + +resource "random_pet" "main" { + length = 1 + prefix = "tgw-pd" + separator = "-" +} + +variable "license" { + type = string +} + +locals { + labels = { + oktodelete = "true" + department = "engineering" + product = "server" + repository = "terraform-google-wandb" + description = "public-dns" + environment = "test" + } +} + +module "wandb" { + source = "../../" + + namespace = random_pet.main.id + subdomain = random_pet.main.id + license = var.license + domain_name = "wandb.ml" + + create_redis = true + use_internal_queue = true + + deletion_protection = false + + labels = local.labels +} + +output "url" { + value = module.wandb.url +} + +output "health_check_url" { + value = "${module.wandb.url}/health" +} diff --git a/tests/public-dns/versions.tf b/tests/public-dns/versions.tf new file mode 100644 index 00000000..49188454 --- /dev/null +++ b/tests/public-dns/versions.tf @@ -0,0 +1,11 @@ +terraform { + required_version = ">= 0.14" + + cloud { + organization = "weights-and-biases" + + workspaces { + name = "terraform-google-wandb-public-dns" + } + } +} \ No newline at end of file