Add google acceptance test
parent
42118e268e
commit
d6a88f8d00
|
@ -12,6 +12,9 @@ jobs:
|
|||
ACC_PATTERN: << parameters.pattern >>
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
CHECKPOINT_DISABLE: 'true' # Disable terraform version check
|
||||
CLOUDSDK_CORE_PROJECT: driftctl-qa-1
|
||||
GOOGLE_APPLICATION_CREDENTIALS: /tmp/google.json
|
||||
ACC_GOOGLE_CREDENTIALS: /tmp/google-admin.json
|
||||
steps:
|
||||
- checkout
|
||||
- go/install:
|
||||
|
@ -19,6 +22,11 @@ jobs:
|
|||
# Disable cache at it seem to broke go 1.16 installation
|
||||
cache: false
|
||||
- run: make install-tools
|
||||
- run:
|
||||
name: Setup Google credentials
|
||||
command: |
|
||||
echo ${GCLOUD_KEYFILE} | base64 -d > /tmp/google.json
|
||||
echo ${ACC_GCLOUD_KEYFILE} | base64 -d > /tmp/google-admin.json
|
||||
- run:
|
||||
name: Run acceptance tests
|
||||
command: make acc
|
||||
|
@ -154,6 +162,7 @@ workflows:
|
|||
pattern:
|
||||
- TestAcc_Aws
|
||||
- TestAcc_Github_
|
||||
- TestAcc_Google
|
||||
context:
|
||||
- driftctl-acc
|
||||
triggers:
|
||||
|
@ -188,6 +197,7 @@ workflows:
|
|||
pattern:
|
||||
- TestAcc_Aws
|
||||
- TestAcc_Github_
|
||||
- TestAcc_Google
|
||||
context:
|
||||
- driftctl-acc
|
||||
push:
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package google_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cloudskiff/driftctl/test"
|
||||
"github.com/cloudskiff/driftctl/test/acceptance"
|
||||
)
|
||||
|
||||
func TestAcc_Google_StorageBucket(t *testing.T) {
|
||||
acceptance.Run(t, acceptance.AccTestCase{
|
||||
TerraformVersion: "0.15.5",
|
||||
Paths: []string{"./testdata/acc/google_storage_bucket"},
|
||||
Args: []string{
|
||||
"scan",
|
||||
"--to", "gcp+tf",
|
||||
"--filter", "Type=='google_storage_bucket'",
|
||||
},
|
||||
Checks: []acceptance.AccCheck{
|
||||
{
|
||||
Check: func(result *test.ScanResult, stdout string, err error) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
result.AssertInfrastructureIsInSync()
|
||||
result.AssertManagedCount(3)
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/hashicorp/google" {
|
||||
version = "3.78.0"
|
||||
constraints = "3.78.0"
|
||||
hashes = [
|
||||
"h1:iCyTW8BWdr6Bvd5B89wkxlrB8xLxqHvT1CPmGuKembU=",
|
||||
"zh:027971c4689b6130619827fe57ce260aaca060db3446817d3a92869dba7cc07f",
|
||||
"zh:0876dbecc0d441bf2479edd17fe9141d77274b5071ea5f68ac26a2994bff66f3",
|
||||
"zh:2a5363ed6b1b880f5284e604567cfdabecca809584c30bbe7f19ff568d1ea4cd",
|
||||
"zh:2f5af69b70654bda91199f6393253e3e479107deebfeddc3fe5850b3a1e83dfb",
|
||||
"zh:52e6816ef11f5f799a6626dfff384e2153b37450d8320f1ef1eee8f71a2a87b2",
|
||||
"zh:59ae534607db13db35c0015c06d1ae6d4886f01f7e8fd4e07bc120236a01c494",
|
||||
"zh:65ab2ed1746ea02d0b1bbd8a22ff3a95d09dc8bdb3841fbc17e45e9feccfb327",
|
||||
"zh:877a71d24ff65ede3f0c5973168acfeaea0f2fea3757cab5600efcddfd3171d5",
|
||||
"zh:8b10c9643a4a53148f6758bfd60804b33c2b838482f2c39ed210b729e6b1e2e8",
|
||||
"zh:ba682648d9f6c11a6d04a250ac79eec39271f615f3ff60c5ae73ebfcc2cdb450",
|
||||
"zh:e946561921e0279450e9b9f705de9354ce35562ed4cc0d4cd3512aa9eb1f6486",
|
||||
]
|
||||
}
|
||||
|
||||
provider "registry.terraform.io/hashicorp/random" {
|
||||
version = "3.1.0"
|
||||
hashes = [
|
||||
"h1:BZMEPucF+pbu9gsPk0G0BHx7YP04+tKdq2MrRDF1EDM=",
|
||||
"zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc",
|
||||
"zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626",
|
||||
"zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff",
|
||||
"zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2",
|
||||
"zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992",
|
||||
"zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427",
|
||||
"zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc",
|
||||
"zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f",
|
||||
"zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b",
|
||||
"zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7",
|
||||
"zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a",
|
||||
]
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
provider "google" {}
|
||||
|
||||
terraform {
|
||||
required_version = "~> 0.15.0"
|
||||
required_providers {
|
||||
google = {
|
||||
version = "3.78.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "random_string" "postfix" {
|
||||
length = 6
|
||||
upper = false
|
||||
special = false
|
||||
}
|
||||
|
||||
resource "google_storage_bucket" "driftctl-unittest" {
|
||||
name = "driftctl-unittest-${count.index}-${random_string.postfix.result}"
|
||||
location = "EU"
|
||||
count = 3
|
||||
}
|
Loading…
Reference in New Issue