Skip to content

Commit

Permalink
Make tests self-contained (#17)
Browse files Browse the repository at this point in the history
remove data dependencies
  • Loading branch information
murggu authored Nov 23, 2022
1 parent be23936 commit 8e838a6
Show file tree
Hide file tree
Showing 312 changed files with 3,279 additions and 1,424 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aks-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/analysis-services-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/application-insights.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/bastion-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v -timeout 30m
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/cognitive-search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v -timeout 30m
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/cognitive-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/container-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/cosmosdb-account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v -timeout 30m
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/data-factory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/event-hubs-namespace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/key-vault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/machine-learning-compute-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/machine-learning-synapse-spark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/machine-learning-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/mariadb-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/mysql-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/network-security-group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/network-security-rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/postgresql-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/private-dns-zone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/resource-group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/route-table.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/route.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/sql-database-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/sql-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/storage-account.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/subnet-route-table-association.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/subnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/synapse-private-link-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/synapse-spark-pool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/synapse-sql-pool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v -timeout 30m
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/user-assigned-identity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/virtual-machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
2 changes: 1 addition & 1 deletion .github/workflows/virtual-network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"

- name: Unit-test
run: go test -v
run: go test -v -timeout 45m
env:
GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
3 changes: 1 addition & 2 deletions terraform/aks-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ resource "azurerm_kubernetes_cluster" "adl_aks" {

api_server_authorized_ip_ranges = var.api_server_authorized_ip_ranges
role_based_access_control_enabled = var.role_based_access_control_enabled

}
}
13 changes: 12 additions & 1 deletion terraform/aks-cluster/test/aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module "aks" {
source = "../"

basename = random_string.postfix.result
rg_name = var.rg_name
rg_name = module.local_rg.name
location = var.location
dns_prefix = "azdatalbsaks"

Expand All @@ -13,4 +13,15 @@ module "aks" {
}

tags = {}
}

# Module dependencies

module "local_rg" {
source = "../../resource-group"

basename = random_string.postfix.result
location = var.location

tags = local.tags
}
7 changes: 7 additions & 0 deletions terraform/aks-cluster/test/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
locals {
tags = {
Project = "Azure/azure-data-labs-modules"
Module = "aks-cluster"
Toolkit = "Terraform"
}
}
1 change: 0 additions & 1 deletion terraform/aks-cluster/test/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ output "name" {
value = module.aks.name
}


output "all" {
value = module.aks.all
sensitive = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "= 3.31.0"
version = "= 3.32.0"
}
}

Expand Down
1 change: 0 additions & 1 deletion terraform/aks-cluster/test/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ func TestModule(t *testing.T) {
assert.NotNil(name)
all := terraform.Output(t, terraformOptions, "all")
assert.NotNil(all)

}
7 changes: 1 addition & 6 deletions terraform/aks-cluster/test/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,4 @@ resource "random_string" "postfix" {
variable "location" {
type = string
default = "North Europe"
}

variable "rg_name" {
type = string
default = "rg-adl-modules-test-01"
}
}
Loading

0 comments on commit 8e838a6

Please sign in to comment.