Skip to content

Commit 24c628c

Browse files
committed
Adding update tests
1 parent 3593a30 commit 24c628c

File tree

2 files changed

+141
-8
lines changed

2 files changed

+141
-8
lines changed

mmv1/products/developerconnect/Connection.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ examples:
2727
primary_resource_id: 'my-connection'
2828
primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])'
2929
vars:
30-
connection_name: 'tf-test-connection'
30+
connection_name: 'tf-test-connection'
3131
- name: 'developer_connect_connection_github_doc'
3232
exclude_test: true
3333
- name: 'developer_connect_connection_github_enterprise'
@@ -189,6 +189,7 @@ properties:
189189
Optional. This checksum is computed by the server based on the value of other
190190
fields, and may be sent on update and delete requests to ensure the
191191
client has an up-to-date value before proceeding.
192+
output: true
192193
- name: uid
193194
type: String
194195
description: Output only. A system-assigned unique identifier for a the GitRepositoryLink.
@@ -300,11 +301,13 @@ properties:
300301
description: |-
301302
Output only. Message of what the user should do next to continue the installation.
302303
Empty string if the installation is already complete.
304+
output: true
303305
- name: actionUri
304306
type: String
305307
description: |-
306308
Output only. Link to follow for next action. Empty string if the installation is already
307309
complete.
310+
output: true
308311
- name: stage
309312
type: String
310313
description: |-

mmv1/third_party/terraform/services/developerconnect/resource_developer_connect_connection_test.go.tmpl

+137-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestAccDeveloperConnectConnection_developerConnectConnectionGithubUpdate(t
3636
ResourceName: "google_developer_connect_connection.my-connection",
3737
ImportState: true,
3838
ImportStateVerify: true,
39-
ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels"},
39+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
4040
},
4141
},
4242
})
@@ -66,6 +66,12 @@ func testAccDeveloperConnectConnection_GithubUpdate(context map[string]interface
6666
resource "google_developer_connect_connection" "my-connection" {
6767
location = "us-central1"
6868
connection_id = "tf-test-tf-test-connection%{random_suffix}"
69+
annotations = {}
70+
labels = {}
71+
72+
crypto_key_config {
73+
key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key"
74+
}
6975

7076
github_config {
7177
github_app = "DEVELOPER_CONNECT"
@@ -98,7 +104,7 @@ func TestAccDeveloperConnectConnection_developerConnectConnectionGithubEnterpris
98104
ResourceName: "google_developer_connect_connection.my-connection",
99105
ImportState: true,
100106
ImportStateVerify: true,
101-
ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels", "ssl_ca_certificate"},
107+
ImportStateVerifyIgnore: []string{"connection_id", "labels", "terraform_labels"},
102108
},
103109
{
104110
Config: testAccDeveloperConnectConnection_GithubEnterpriseUpdate(context),
@@ -107,7 +113,7 @@ func TestAccDeveloperConnectConnection_developerConnectConnectionGithubEnterpris
107113
ResourceName: "google_developer_connect_connection.my-connection",
108114
ImportState: true,
109115
ImportStateVerify: true,
110-
ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels", "ssl_ca_certificate"},
116+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
111117
},
112118
},
113119
})
@@ -136,6 +142,12 @@ func testAccDeveloperConnectConnection_GithubEnterpriseUpdate(context map[string
136142
resource "google_developer_connect_connection" "my-connection" {
137143
location = "us-central1"
138144
connection_id = "tf-test-tf-test-connection%{random_suffix}"
145+
annotations = {}
146+
labels = {}
147+
148+
crypto_key_config {
149+
key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key"
150+
}
139151

140152
github_enterprise_config {
141153
host_uri = "https://ghe.proctor-staging-test.com"
@@ -149,6 +161,54 @@ resource "google_developer_connect_connection" "my-connection" {
149161
}
150162

151163

164+
func TestAccDeveloperConnectConnection_GhePrivConnection(t *testing.T) {
165+
t.Parallel()
166+
167+
context := map[string]interface{}{
168+
"random_suffix": acctest.RandString(t, 10),
169+
}
170+
171+
acctest.VcrTest(t, resource.TestCase{
172+
PreCheck: func() { acctest.AccTestPreCheck(t) },
173+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
174+
Steps: []resource.TestStep{
175+
{
176+
Config: testAccDeveloperConnectConnection_GhePrivConnection(context),
177+
},
178+
{
179+
ResourceName: "google_developer_connect_connection.my-connection",
180+
ImportState: true,
181+
ImportStateVerify: true,
182+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
183+
},
184+
},
185+
})
186+
}
187+
188+
189+
func testAccDeveloperConnectConnection_GhePrivConnection(context map[string]interface{}) string {
190+
return acctest.Nprintf(`
191+
resource "google_developer_connect_connection" "my-connection" {
192+
location = "us-central1"
193+
connection_id = "tf-test-tf-test-connection%{random_suffix}"
194+
annotations = {}
195+
labels = {}
196+
197+
github_enterprise_config {
198+
host_uri = "https://ghe.proctor-private-ca.com"
199+
200+
ssl_ca_certificate = "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIUANaBCc9j/xdKJHU0sgmv6yE2WCIwDQYJKoZIhvcNAQEL\nBQAwLDEUMBIGA1UEChMLUHJvY3RvciBFbmcxFDASBgNVBAMTC1Byb2N0b3ItZW5n\nMB4XDTIxMDcxNTIwMDcwMloXDTIyMDcxNTIwMDcwMVowADCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBAMVel7I88DkhwW445BNPBZvJNTV1AreHdz4um4U1\nop2+4L7JeNrUs5SRc0fzeOyOmA9ZzTDu9hBC7zj/sVNUy6cIQGCj32sr5SCAEIat\nnFZlzmVqJPT4J5NAaE37KO5347myTJEBrvpq8az4CtvX0yUzPK0gbUmaSaztVi4o\ndbJLKyv575xCLC/Hu6fIHBDH19eG1Ath9VpuAOkttRRoxu2VqijJZrGqaS+0o+OX\nrLi5HMtZbZjgQB4mc1g3ZDKX/gynxr+CDNaqNOqxuog33Tl5OcOk9DrR3MInaE7F\nyQFuH9mzF64AqOoTf7Tr/eAIz5XVt8K51nk+fSybEfKVwtM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sHo9SmXCrmOwVQPKrEw\nm+A+5TjXLmenyaBhqXa0vkAZYJhWdROhWC0VTA==\n-----END CERTIFICATE-----\n"
201+
202+
service_directory_config {
203+
service = "projects/devconnect-terraform-creds/locations/us-central1/namespaces/my-namespace/services/terraform-github"
204+
}
205+
}
206+
207+
}
208+
`, context)
209+
}
210+
211+
152212
func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabUpdate(t *testing.T) {
153213
t.Parallel()
154214

@@ -167,7 +227,7 @@ func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabUpdate(t
167227
ResourceName: "google_developer_connect_connection.my-connection",
168228
ImportState: true,
169229
ImportStateVerify: true,
170-
ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels"},
230+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
171231
},
172232
{
173233
Config: testAccDeveloperConnectConnection_GitlabUpdate(context),
@@ -176,7 +236,7 @@ func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabUpdate(t
176236
ResourceName: "google_developer_connect_connection.my-connection",
177237
ImportState: true,
178238
ImportStateVerify: true,
179-
ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels"},
239+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
180240
},
181241
},
182242
})
@@ -210,6 +270,12 @@ func testAccDeveloperConnectConnection_GitlabUpdate(context map[string]interface
210270
resource "google_developer_connect_connection" "my-connection" {
211271
location = "us-central1"
212272
connection_id = "tf-test-tf-test-connection%{random_suffix}"
273+
annotations = {}
274+
labels = {}
275+
276+
crypto_key_config {
277+
key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key"
278+
}
213279

214280
gitlab_config {
215281
webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-webhook/versions/latest"
@@ -226,6 +292,64 @@ resource "google_developer_connect_connection" "my-connection" {
226292
`, context)
227293
}
228294

295+
func TestAccDeveloperConnectConnection_GlePrivConnection(t *testing.T) {
296+
t.Parallel()
297+
298+
context := map[string]interface{}{
299+
"random_suffix": acctest.RandString(t, 10),
300+
}
301+
302+
acctest.VcrTest(t, resource.TestCase{
303+
PreCheck: func() { acctest.AccTestPreCheck(t) },
304+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
305+
Steps: []resource.TestStep{
306+
{
307+
Config: testAccDeveloperConnectConnection_GlePrivConnection(context),
308+
},
309+
{
310+
ResourceName: "google_developer_connect_connection.my-connection",
311+
ImportState: true,
312+
ImportStateVerify: true,
313+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
314+
},
315+
},
316+
})
317+
}
318+
319+
320+
func testAccDeveloperConnectConnection_GlePrivConnection(context map[string]interface{}) string {
321+
return acctest.Nprintf(`
322+
resource "google_developer_connect_connection" "my-connection" {
323+
location = "us-central1"
324+
connection_id = "tf-test-tf-test-connection%{random_suffix}"
325+
annotations = {}
326+
labels = {}
327+
328+
gitlab_enterprise_config {
329+
host_uri = "https://gle-us.gle-us-private.com"
330+
331+
webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-webhook/versions/latest"
332+
333+
read_authorizer_credential {
334+
user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gle-private-read-token/versions/latest"
335+
}
336+
337+
authorizer_credential {
338+
user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gle-private-api/versions/latest"
339+
}
340+
341+
ssl_ca_certificate = "-----BEGIN CERTIFICATE-----\nMIIFbjCCA1agAwIBAgIUH+nsWsqagMW9Ld8E9J71yPLPpD8wDQYJKoZIhvcNAQEL\nBQAwJDEiMCAGA1UEAwwZZ2xlLXVzLmdsZS11cy1wcml2YXRlLmNvbTAeFw0yNDEw\nMzExNjQzMjBaFw0zNDEwMjkxNjQzMjBaMCQxIjAgBgNVBAMMGWdsZS11cy5nbGUt\ndXMtcHJpdmF0ZS5jb20wggIiMA0GCSqGSIb3DQEBAQ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C\nzZAhg5oedAzcakZpYwZDSiLuPgsQfwgRnqWIYR8JcIM5bKRZNGyOg8eZ8cKu23A2\nPavL4B3Ra1l93KllKm21rigIhLPIPLoEyxEg9c9oTJF92r0+aRdf2Ln853260Fqf\ncEUWoXhqMGvDv/YEbqDjGQ/Kh7ZWdlIWhcKFOA0gluF7oExjt/MgSitukgg3aaic\n/eXXOrZDNYH7Ve610NUuNlhub1M47Tp7EgjUJVWlsKK84T8ZcZq7Hn4BzioUr95d\nHao6u19HWA/ISM8bwzHaYxscFI4u6phEL0HJzLf4EysEmS0rAnLxyol0apNx6znR\nhXsqxnSexKhXoLqnK1Vuhcg8DsvobXHqg68EGZ7BZ3ycPYaHSWU8Xh3l1gtYkcQ6\nzxXsKIijlpVKuYJvGA3EOMoZu6+2MYF8Tgp3N4sKMvPhqBhsmgxOYF5OkAbGlsUP\nyCYWFDBFHmbhvUu5JpbKuID2CPkBi16EetemvMQ9PGlLq/0fO/BBNkn6TYn9Kvg8\nAyvuONz54uFEAIKPCcZIosa3ml+5/pt+tBhtVzHA6vMxn18IYaNpuTwSxi/+M10K\nRjw=\n-----END CERTIFICATE-----\n"
342+
343+
344+
service_directory_config {
345+
service = "projects/devconnect-terraform-creds/locations/us-central1/namespaces/my-namespace/services/terraform-gle"
346+
}
347+
}
348+
349+
}
350+
`, context)
351+
}
352+
229353

230354
func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabEnterpriseUpdate(t *testing.T) {
231355
t.Parallel()
@@ -245,7 +369,7 @@ func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabEnterpris
245369
ResourceName: "google_developer_connect_connection.my-connection",
246370
ImportState: true,
247371
ImportStateVerify: true,
248-
ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels"},
372+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
249373
},
250374
{
251375
Config: testAccDeveloperConnectConnection_GitlabEnterpriseUpdate(context),
@@ -254,7 +378,7 @@ func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabEnterpris
254378
ResourceName: "google_developer_connect_connection.my-connection",
255379
ImportState: true,
256380
ImportStateVerify: true,
257-
ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels"},
381+
ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"},
258382
},
259383
},
260384
})
@@ -290,6 +414,12 @@ func testAccDeveloperConnectConnection_GitlabEnterpriseUpdate(context map[string
290414
resource "google_developer_connect_connection" "my-connection" {
291415
location = "us-central1"
292416
connection_id = "tf-test-tf-test-connection%{random_suffix}"
417+
annotations = {}
418+
labels = {}
419+
420+
crypto_key_config {
421+
key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key"
422+
}
293423

294424
gitlab_enterprise_config {
295425
host_uri = "https://gle-us-central1.gcb-test.com"

0 commit comments

Comments
 (0)