-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(mc): add terratest and GH workflow
- Loading branch information
Showing
21 changed files
with
406 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Test Multicloud | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'test/multicloud/**' | ||
|
||
jobs: | ||
multicloud-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.23' | ||
|
||
- name: Install dependencies | ||
run: go mod download | ||
|
||
- name: Run tests | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module "aks" { | ||
source = "../../modules/aks" | ||
location = var.location | ||
resource_group_name = var.resource_group_name | ||
prefix = var.prefix | ||
labels = var.labels | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
terraform { | ||
required_version = "1.8.3" | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "4.15.0" | ||
} | ||
} | ||
} | ||
|
||
# Initialize the Azure provider | ||
provider "azurerm" { | ||
features { | ||
resource_group { | ||
prevent_deletion_if_contains_resources = false | ||
} | ||
} | ||
subscription_id = var.subscription_id | ||
tenant_id = var.tenant_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
variable "subscription_id" { | ||
description = "The subscription ID for the Azure account." | ||
type = string | ||
} | ||
|
||
variable "tenant_id" { | ||
description = "The tenant ID for the Azure account." | ||
type = string | ||
} | ||
|
||
variable "location" { | ||
description = "The Azure Cloud location where AKS will be deployed to." | ||
type = string | ||
} | ||
|
||
variable "resource_group_name" { | ||
description = "The name of the resource group." | ||
type = string | ||
} | ||
|
||
variable "prefix" { | ||
description = "A prefix to add to all resources." | ||
type = string | ||
} | ||
|
||
variable "labels" { | ||
description = "A map of labels to add to all resources." | ||
type = map(string) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module "gke" { | ||
source = "../../modules/gke" | ||
location = var.location | ||
prefix = var.prefix | ||
project = var.project | ||
machine_type = var.machine_type | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
terraform { | ||
required_version = "1.8.3" | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "6.17.0" | ||
} | ||
} | ||
} | ||
|
||
# Initialize the Google provider | ||
provider "google" { | ||
project = var.project | ||
region = var.location | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
variable "project" { | ||
description = "The Google Cloud project where resources will be deployed." | ||
type = string | ||
} | ||
|
||
variable "location" { | ||
description = "The Google Cloud location where GKE will be deployed to." | ||
type = string | ||
} | ||
|
||
variable "prefix" { | ||
description = "A prefix to add to all resources." | ||
type = string | ||
} | ||
|
||
variable "machine_type" { | ||
description = "The machine type to use for the GKE nodes." | ||
type = string | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module "kind" { | ||
source = "../../modules/kind" | ||
prefix = var.prefix | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
terraform { | ||
required_version = "1.8.3" | ||
required_providers { | ||
kind = { | ||
source = "tehcyx/kind" | ||
version = "0.7.0" | ||
} | ||
} | ||
} | ||
|
||
# Initialize the kind provider | ||
provider "kind" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apiVersion: v1 | ||
kind: Config | ||
preferences: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "prefix" { | ||
description = "A prefix to add to all resources." | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
) | ||
|
||
func TestAKSExample(t *testing.T) { | ||
t.Parallel() | ||
|
||
opts := &terraform.Options{ | ||
TerraformDir: "../examples/aks", | ||
|
||
Vars: map[string]interface{}{ | ||
"prefix": "test", | ||
"location": "uksouth", | ||
"subscription_id": "d6050d84-e4dd-463d-afc7-a6ab3dc33ab7", // TODO: replace with actual project once we get azure "public" access | ||
"tenant_id": "ac8a4ccd-35f1-4f95-a688-f68e3d89adfc", | ||
"resource_group_name": "test", | ||
"labels": map[string]string{ | ||
"environment": "test", | ||
"owner": "test", | ||
"project": "test", | ||
}, | ||
}, | ||
} | ||
|
||
// clean up at the end of the test | ||
defer terraform.Destroy(t, opts) | ||
|
||
terraform.Init(t, opts) | ||
|
||
// TODO: uncomment once we get creds for azure "public" | ||
// terraform.Apply(t, opts) | ||
|
||
// TODO: add actual tests here | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
) | ||
|
||
func TestGKEExample(t *testing.T) { | ||
t.Parallel() | ||
|
||
opts := &terraform.Options{ | ||
TerraformDir: "../examples/gke", | ||
|
||
Vars: map[string]interface{}{ | ||
"prefix": "test", | ||
"location": "eu-central1", | ||
"project": "mc-retina", // TODO: replace with actual project once we get gcloud access | ||
"machine_type": "e2-standard-4", | ||
}, | ||
} | ||
|
||
// clean up at the end of the test | ||
defer terraform.Destroy(t, opts) | ||
|
||
terraform.Init(t, opts) | ||
|
||
// TODO: uncomment once we get creds for gcloud | ||
// terraform.Apply(t, opts) | ||
|
||
// TODO: add actual tests here | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gruntwork-io/terratest/modules/terraform" | ||
) | ||
|
||
func TestKindExample(t *testing.T) { | ||
t.Parallel() | ||
|
||
opts := &terraform.Options{ | ||
TerraformDir: "../examples/kind", | ||
|
||
Vars: map[string]interface{}{ | ||
"prefix": "test", | ||
}, | ||
} | ||
|
||
// clean up at the end of the test | ||
defer terraform.Destroy(t, opts) | ||
|
||
terraform.Init(t, opts) | ||
terraform.Apply(t, opts) | ||
|
||
// TODO: add actual tests here | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module github.com/microsoft/retina/test/multicloud/test | ||
|
||
go 1.23.4 | ||
|
||
require ( | ||
github.com/agext/levenshtein v1.2.3 // indirect | ||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect | ||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/gruntwork-io/terratest v0.48.1 // indirect | ||
github.com/hashicorp/errwrap v1.0.0 // indirect | ||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect | ||
github.com/hashicorp/go-getter/v2 v2.2.3 // indirect | ||
github.com/hashicorp/go-multierror v1.1.1 // indirect | ||
github.com/hashicorp/go-safetemp v1.0.0 // indirect | ||
github.com/hashicorp/go-version v1.7.0 // indirect | ||
github.com/hashicorp/hcl/v2 v2.22.0 // indirect | ||
github.com/hashicorp/terraform-json v0.23.0 // indirect | ||
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect | ||
github.com/klauspost/compress v1.16.5 // indirect | ||
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect | ||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/stretchr/testify v1.9.0 // indirect | ||
github.com/tmccombs/hcl2json v0.6.4 // indirect | ||
github.com/ulikunitz/xz v0.5.10 // indirect | ||
github.com/zclconf/go-cty v1.15.0 // indirect | ||
golang.org/x/crypto v0.29.0 // indirect | ||
golang.org/x/mod v0.18.0 // indirect | ||
golang.org/x/net v0.31.0 // indirect | ||
golang.org/x/sync v0.9.0 // indirect | ||
golang.org/x/sys v0.27.0 // indirect | ||
golang.org/x/text v0.20.0 // indirect | ||
golang.org/x/tools v0.22.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.