Skip to content

Commit 4f54363

Browse files
chore: adding retry in instance_Simple test (#573)
1 parent e84f8fb commit 4f54363

File tree

10 files changed

+166
-230
lines changed

10 files changed

+166
-230
lines changed

test/integration/go.mod

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
module github.com/terraform-google-modules/terraform-google-vm/test/integration
1+
module github.com/terraform-google-modules/terraform-google-sql-db/test/integration
22

3-
go 1.24.0
3+
go 1.23.0
44

5-
toolchain go1.24.13
5+
toolchain go1.24.7
66

77
require (
8-
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.18.0
8+
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.9
99
github.com/stretchr/testify v1.11.1
1010
)
1111

@@ -19,9 +19,9 @@ require (
1919
github.com/go-openapi/jsonpointer v0.21.0 // indirect
2020
github.com/go-openapi/jsonreference v0.20.2 // indirect
2121
github.com/go-openapi/swag v0.23.0 // indirect
22-
github.com/google/gnostic-models v0.7.0 // indirect
22+
github.com/google/gnostic-models v0.6.9 // indirect
2323
github.com/google/go-cmp v0.7.0 // indirect
24-
github.com/gruntwork-io/terratest v0.54.0 // indirect
24+
github.com/gruntwork-io/terratest v0.50.0 // indirect
2525
github.com/hashicorp/errwrap v1.1.0 // indirect
2626
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
2727
github.com/hashicorp/go-getter/v2 v2.2.3 // indirect
@@ -30,8 +30,8 @@ require (
3030
github.com/hashicorp/go-version v1.7.0 // indirect
3131
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f // indirect
3232
github.com/hashicorp/hcl/v2 v2.22.0 // indirect
33-
github.com/hashicorp/terraform-config-inspect v0.0.0-20250828155816-225c06ed5fd9 // indirect
34-
github.com/hashicorp/terraform-json v0.27.2 // indirect
33+
github.com/hashicorp/terraform-config-inspect v0.0.0-20250731202709-e8a84eebd3e7 // indirect
34+
github.com/hashicorp/terraform-json v0.26.0 // indirect
3535
github.com/jinzhu/copier v0.4.0 // indirect
3636
github.com/josharian/intern v1.0.0 // indirect
3737
github.com/klauspost/compress v1.16.7 // indirect
@@ -48,18 +48,18 @@ require (
4848
github.com/tidwall/sjson v1.2.5 // indirect
4949
github.com/tmccombs/hcl2json v0.6.4 // indirect
5050
github.com/ulikunitz/xz v0.5.14 // indirect
51-
github.com/zclconf/go-cty v1.16.4 // indirect
51+
github.com/zclconf/go-cty v1.16.3 // indirect
5252
go.yaml.in/yaml/v2 v2.4.2 // indirect
53-
go.yaml.in/yaml/v3 v3.0.4 // indirect
54-
golang.org/x/crypto v0.45.0 // indirect
55-
golang.org/x/mod v0.31.0 // indirect
56-
golang.org/x/net v0.47.0 // indirect
57-
golang.org/x/sync v0.18.0 // indirect
58-
golang.org/x/sys v0.38.0 // indirect
59-
golang.org/x/text v0.31.0 // indirect
60-
golang.org/x/tools v0.39.0 // indirect
61-
google.golang.org/protobuf v1.36.5 // indirect
53+
go.yaml.in/yaml/v3 v3.0.3 // indirect
54+
golang.org/x/crypto v0.40.0 // indirect
55+
golang.org/x/mod v0.27.0 // indirect
56+
golang.org/x/net v0.42.0 // indirect
57+
golang.org/x/sync v0.16.0 // indirect
58+
golang.org/x/sys v0.34.0 // indirect
59+
golang.org/x/text v0.27.0 // indirect
60+
golang.org/x/tools v0.35.0 // indirect
61+
google.golang.org/protobuf v1.36.1 // indirect
6262
gopkg.in/yaml.v3 v3.0.1 // indirect
63-
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
64-
sigs.k8s.io/kustomize/kyaml v0.21.0 // indirect
63+
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
64+
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
6565
)

test/integration/go.sum

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.9 h1:R7TF5kSOr+6fu9CFCdza5DIFLCQYGrQP923G7SaHd2Y=
22
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.9/go.mod h1:KfuvXj6g70rv3AI3D0+4aq9Icf/Axu156s6h1JeDJt4=
3-
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.18.0 h1:i7ReU+tZORrSoM9twwSN5rfrDXtuzBTFwUKKuARgdp8=
4-
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.18.0/go.mod h1:nEy338yUjKkv7tMXBy7ervFU+j1NIh9tUUTAEJgygJ4=
53
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
64
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
75
github.com/alexflint/go-filemutex v1.3.0 h1:LgE+nTUWnQCyRKbpoceKZsPQbs84LivvgwUymZXdOcM=
@@ -29,16 +27,12 @@ github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
2927
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
3028
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
3129
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
32-
github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo=
33-
github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ=
3430
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
3531
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
3632
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
3733
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
3834
github.com/gruntwork-io/terratest v0.50.0 h1:AbBJ7IRCpLZ9H4HBrjeoWESITv8nLjN6/f1riMNcAsw=
3935
github.com/gruntwork-io/terratest v0.50.0/go.mod h1:see0lbKvAqz6rvzvN2wyfuFQQG4PWcAb2yHulF6B2q4=
40-
github.com/gruntwork-io/terratest v0.54.0 h1:JOVATYDpU0NAPbEkgYUP50BR2m45UGiR4dbs20sKzck=
41-
github.com/gruntwork-io/terratest v0.54.0/go.mod h1:QvwQWZMTJmJB4E0d1Uc18quQm7+X53liKKp+fJSuaKA=
4236
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
4337
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
4438
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -58,12 +52,8 @@ github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul1
5852
github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA=
5953
github.com/hashicorp/terraform-config-inspect v0.0.0-20250731202709-e8a84eebd3e7 h1:NIwoxkIKF4OAbTze/gukXLJqS9MISRXCqn4SnurhZ1I=
6054
github.com/hashicorp/terraform-config-inspect v0.0.0-20250731202709-e8a84eebd3e7/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
61-
github.com/hashicorp/terraform-config-inspect v0.0.0-20250828155816-225c06ed5fd9 h1:1MLunZqjVd9j5gc5kjE04VEoieDVdWdgdM6T2fNQvY8=
62-
github.com/hashicorp/terraform-config-inspect v0.0.0-20250828155816-225c06ed5fd9/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
6355
github.com/hashicorp/terraform-json v0.26.0 h1:+BnJavhRH+oyNWPnfzrfQwVWCZBFMvjdiH2Vi38Udz4=
6456
github.com/hashicorp/terraform-json v0.26.0/go.mod h1:eyWCeC3nrZamyrKLFnrvwpc3LQPIJsx8hWHQ/nu2/v4=
65-
github.com/hashicorp/terraform-json v0.27.2 h1:BwGuzM6iUPqf9JYM/Z4AF1OJ5VVJEEzoKST/tRDBJKU=
66-
github.com/hashicorp/terraform-json v0.27.2/go.mod h1:GzPLJ1PLdUG5xL6xn1OXWIjteQRT2CNT9o/6A9mi9hE=
6757
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
6858
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
6959
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
@@ -119,51 +109,31 @@ github.com/ulikunitz/xz v0.5.14 h1:uv/0Bq533iFdnMHZdRBTOlaNMdb1+ZxXIlHDZHIHcvg=
119109
github.com/ulikunitz/xz v0.5.14/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
120110
github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk=
121111
github.com/zclconf/go-cty v1.16.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
122-
github.com/zclconf/go-cty v1.16.4 h1:QGXaag7/7dCzb+odlGrgr+YmYZFaOCMW6DEpS+UD1eE=
123-
github.com/zclconf/go-cty v1.16.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
124112
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
125113
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
126114
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
127115
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
128116
go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE=
129117
go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI=
130-
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
131-
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
132118
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
133119
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
134-
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
135-
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
136120
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
137121
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
138-
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
139-
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
140122
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
141123
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
142-
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
143-
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
144124
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
145125
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
146-
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
147-
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
148126
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
149127
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
150128
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
151-
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
152-
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
153129
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg=
154130
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0=
155131
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
156132
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
157-
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
158-
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
159133
golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
160134
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
161-
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
162-
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
163135
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
164136
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
165-
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
166-
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
167137
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
168138
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
169139
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
@@ -173,13 +143,9 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
173143
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
174144
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 h1:hcha5B1kVACrLujCKLbr8XWMxCxzQx42DY8QKYJrDLg=
175145
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7/go.mod h1:GewRfANuJ70iYzvn+i4lezLDAFzvjxZYK1gn1lWcfas=
176-
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA=
177-
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts=
178146
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
179147
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
180148
sigs.k8s.io/kustomize/kyaml v0.20.1 h1:PCMnA2mrVbRP3NIB6v9kYCAc38uvFLVs8j/CD567A78=
181149
sigs.k8s.io/kustomize/kyaml v0.20.1/go.mod h1:0EmkQHRUsJxY8Ug9Niig1pUMSCGHxQ5RklbpV/Ri6po=
182-
sigs.k8s.io/kustomize/kyaml v0.21.0 h1:7mQAf3dUwf0wBerWJd8rXhVcnkk5Tvn/q91cGkaP6HQ=
183-
sigs.k8s.io/kustomize/kyaml v0.21.0/go.mod h1:hmxADesM3yUN2vbA5z1/YTBnzLJ1dajdqpQonwBL1FQ=
184150
sigs.k8s.io/yaml v1.5.0 h1:M10b2U7aEUY6hRtU870n2VTPgR5RZiL/I6Lcc2F4NUQ=
185151
sigs.k8s.io/yaml v1.5.0/go.mod h1:wZs27Rbxoai4C0f8/9urLZtZtF3avA3gKvGyPdDqTO4=
Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
// Copyright 2021 Google LLC
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1416

1517
package instance_simple
1618

@@ -24,8 +26,6 @@ import (
2426
)
2527

2628
func TestInstanceSimpleModule(t *testing.T) {
27-
28-
const instanceNamePrefix = "instance-simple"
2929
zoneIns := map[string]string{
3030
"instance-simple-001": "us-central1-a",
3131
"instance-simple-002": "us-central1-b",
@@ -34,16 +34,21 @@ func TestInstanceSimpleModule(t *testing.T) {
3434
}
3535

3636
insSimpleT := tft.NewTFBlueprintTest(t)
37+
3738
insSimpleT.DefineVerify(func(assert *assert.Assertions) {
3839
insSimpleT.DefaultVerify(assert)
3940

40-
instances := gcloud.Run(t, fmt.Sprintf("compute instances list --project %s --filter name~%s", insSimpleT.GetStringOutput("project_id"), instanceNamePrefix))
41-
assert.Equal(len(zoneIns), len(instances.Array()), "found 4 gce instances")
41+
projectId := insSimpleT.GetStringOutput("project_id")
42+
43+
for instanceName, zone := range zoneIns {
44+
op := gcloud.Run(t, fmt.Sprintf("compute instances describe %s --zone %s --project %s", instanceName, zone, projectId))
4245

43-
for _, instance := range instances.Array() {
44-
instanceName := instance.Get("name").String()
45-
assert.Contains(instance.Get("zone").String(), zoneIns[instanceName], fmt.Sprintf("%s is in the right zone", instanceName))
46+
assert.Equal("RUNNING", op.Get("status").String(), fmt.Sprintf("instance %s should be in RUNNING state", instanceName))
47+
48+
actualZone := op.Get("zone").String()
49+
assert.Contains(actualZone, zone, fmt.Sprintf("instance %s should be in zone %s", instanceName, zone))
4650
}
4751
})
52+
4853
insSimpleT.Test()
4954
}

test/integration/mig_autoscaler/controls/mig_autoscaler.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
control "MIG" do
2222
title "Autoscaling Configuration"
2323

24-
describe command("gcloud --project=#{project_id} compute instances list --format=json --filter='name~^mig-autoscaler*'") do
24+
# 1. Instance Verification (Using Strongly Consistent Zonal Query)
25+
# We specify the zones to bypass the global aggregation lag.
26+
describe command("gcloud --project=#{project_id} compute instances list --zones=#{region}-a,#{region}-b,#{region}-c,#{region}-f --format=json --filter='name:mig-autoscaler'") do
2527
its(:exit_status) { should eq 0 }
26-
its(:stderr) { should eq '' }
28+
its(:stderr) { should eq '' } # Will be empty because data is found immediately
2729

2830
let!(:data) do
2931
if subject.exit_status == 0
@@ -40,7 +42,8 @@
4042
end
4143
end
4244

43-
describe command("gcloud --project=#{project_id} compute instance-groups list --format=json --filter='name~^mig-autoscaler*'") do
45+
# 2. Instance Group Verification (Using Strongly Consistent Regional Query)
46+
describe command("gcloud --project=#{project_id} compute instance-groups list --regions=#{region} --format=json --filter='name:mig-autoscaler'") do
4447
its(:exit_status) { should eq 0 }
4548
its(:stderr) { should eq '' }
4649

@@ -59,7 +62,8 @@
5962
end
6063
end
6164

62-
describe command("gcloud --project=#{project_id} compute instance-groups managed list --format=json --filter='name~^mig-autoscaler*'") do
65+
# 3. Managed Instance Group & Autoscaler Verification (Regional Query)
66+
describe command("gcloud --project=#{project_id} compute instance-groups managed list --regions=#{region} --format=json --filter='name:mig-autoscaler'") do
6367
its(:exit_status) { should eq 0 }
6468
its(:stderr) { should eq '' }
6569

@@ -95,5 +99,4 @@
9599
end
96100
end
97101
end
98-
99102
end

test/integration/mig_simple/controls/mig_simple.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
control "MIG" do
2222
title "Simple Configuration"
2323

24-
describe command("gcloud --project=#{project_id} compute instances list --format=json --filter='name~^mig-simple*'") do
24+
# 1. Instance Verification (Using Strongly Consistent Zonal Query)
25+
# We use '--zones' instead of '--regions' because 'instances list' is a zonal command.
26+
# For the standard 'us-central1' test, we check all 4 possible zones.
27+
describe command("gcloud compute instances list --project=#{project_id} --zones=#{region}-a,#{region}-b,#{region}-c,#{region}-f --format=json --filter='name:mig-simple'") do
2528
its(:exit_status) { should eq 0 }
26-
its(:stderr) { should eq '' }
29+
its(:stderr) { should eq '' } # Will be empty because data is found immediately
2730

2831
let!(:data) do
2932
if subject.exit_status == 0
@@ -40,7 +43,8 @@
4043
end
4144
end
4245

43-
describe command("gcloud --project=#{project_id} compute instance-groups list --format=json --filter='name~^mig-simple*'") do
46+
# 2. Instance Group Verification (Regional Query - Supported and Reliable)
47+
describe command("gcloud compute instance-groups list --project=#{project_id} --regions=#{region} --format=json --filter='name:mig-simple'") do
4448
its(:exit_status) { should eq 0 }
4549
its(:stderr) { should eq '' }
4650

@@ -59,7 +63,8 @@
5963
end
6064
end
6165

62-
describe command("gcloud --project=#{project_id} compute instance-groups managed list --format=json --filter='name~^mig-simple*'") do
66+
# 3. Managed Instance Group Verification (Regional Query - Supported and Reliable)
67+
describe command("gcloud compute instance-groups managed list --project=#{project_id} --regions=#{region} --format=json --filter='name:mig-simple'") do
6368
its(:exit_status) { should eq 0 }
6469
its(:stderr) { should eq '' }
6570

@@ -71,11 +76,10 @@
7176
end
7277
end
7378

74-
describe "number of instance groups" do
79+
describe "number of managed instance groups" do
7580
it "should be #{expected_instance_groups}" do
7681
expect(data.length).to eq(expected_instance_groups)
7782
end
7883
end
7984
end
80-
8185
end

0 commit comments

Comments
 (0)