-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: scenario test for SecretManager version alias
- Loading branch information
Showing
12 changed files
with
514 additions
and
5 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
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
14 changes: 14 additions & 0 deletions
14
tests/e2e/testdata/scenarios/secretmanagerversionalias/_export0.yaml
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,14 @@ | ||
apiVersion: secretmanager.cnrm.cloud.google.com/v1beta1 | ||
kind: SecretManagerSecret | ||
metadata: | ||
annotations: | ||
cnrm.cloud.google.com/project-id: ${projectId} | ||
labels: | ||
managed-by-cnrm: "true" | ||
name: secret-${uniqueId} | ||
spec: | ||
replication: | ||
userManaged: | ||
replicas: | ||
- location: us-central1 | ||
resourceID: secret-${uniqueId} |
16 changes: 16 additions & 0 deletions
16
tests/e2e/testdata/scenarios/secretmanagerversionalias/_export3.yaml
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,16 @@ | ||
apiVersion: secretmanager.cnrm.cloud.google.com/v1beta1 | ||
kind: SecretManagerSecret | ||
metadata: | ||
annotations: | ||
cnrm.cloud.google.com/project-id: ${projectId} | ||
labels: | ||
managed-by-cnrm: "true" | ||
name: secret-${uniqueId} | ||
spec: | ||
replication: | ||
userManaged: | ||
replicas: | ||
- location: us-central1 | ||
resourceID: secret-${uniqueId} | ||
versionAliases: | ||
foo: "1" |
115 changes: 115 additions & 0 deletions
115
tests/e2e/testdata/scenarios/secretmanagerversionalias/_http00.log
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,115 @@ | ||
GET https://secretmanager.googleapis.com/v1/projects/${projectId}/secrets/secret-${uniqueId}?%24alt=json%3Benum-encoding%3Dint | ||
Content-Type: application/json | ||
User-Agent: kcc/controller-manager | ||
x-goog-request-params: name=projects%2F${projectId}%2Fsecrets%2Fsecret-${uniqueId} | ||
|
||
404 Not Found | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"error": { | ||
"code": 404, | ||
"details": [ | ||
{ | ||
"@type": "type.googleapis.com/google.rpc.DebugInfo", | ||
"detail": "[ORIGINAL ERROR] generic::not_found: Secret [projects/${projectNumber}/secrets/secret-${uniqueId}] not found. [google.rpc.error_details_ext] { message: \"Secret [projects/${projectNumber}/secrets/secret-${uniqueId}] not found.\" }" | ||
} | ||
], | ||
"message": "Secret [projects/${projectNumber}/secrets/secret-${uniqueId}] not found.", | ||
"status": "NOT_FOUND" | ||
} | ||
} | ||
|
||
--- | ||
|
||
POST https://secretmanager.googleapis.com/v1/projects/${projectId}/secrets?%24alt=json%3Benum-encoding%3Dint&secretId=secret-${uniqueId} | ||
Content-Type: application/json | ||
User-Agent: kcc/controller-manager | ||
x-goog-request-params: parent=projects%2F${projectId} | ||
|
||
{ | ||
"labels": { | ||
"managed-by-cnrm": "true" | ||
}, | ||
"replication": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"etag": "abcdef0123A=", | ||
"labels": { | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectNumber}/secrets/secret-${uniqueId}", | ||
"replication": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
--- | ||
|
||
GET https://secretmanager.googleapis.com/v1/projects/${projectId}/secrets/secret-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"etag": "abcdef0123A=", | ||
"labels": { | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectNumber}/secrets/secret-${uniqueId}", | ||
"replication": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
tests/e2e/testdata/scenarios/secretmanagerversionalias/_http02.log
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,74 @@ | ||
POST https://secretmanager.googleapis.com/v1/projects/${projectId}/secrets/secret-${uniqueId}:addVersion?%24alt=json%3Benum-encoding%3Dint | ||
Content-Type: application/json | ||
User-Agent: kcc/controller-manager | ||
x-goog-request-params: parent=projects%2F${projectId}%2Fsecrets%2Fsecret-${uniqueId} | ||
|
||
{ | ||
"parent": "projects/${projectId}/secrets/secret-${uniqueId}", | ||
"payload": { | ||
"data": "SSBhbHdheXMgbG92ZWQgc3BhcnJpbmcgd2l0aCBnaWFudCBjYW5keSBzd29yZHMsIGJ1dCBJIGhhZCBubyBpZGVhIHRoYXQgd2FzIG15IHN1cGVyIHNlY3JldCBpbmZvcm1hdGlvbiE=" | ||
} | ||
} | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"etag": "abcdef0123A=", | ||
"name": "projects/${projectNumber}/secrets/secret-${uniqueId}/versions/1", | ||
"replicationStatus": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
}, | ||
"state": 1 | ||
} | ||
|
||
--- | ||
|
||
GET https://secretmanager.googleapis.com/v1/projects/${projectId}/secrets/secret-${uniqueId}?%24alt=json%3Benum-encoding%3Dint | ||
Content-Type: application/json | ||
User-Agent: kcc/controller-manager | ||
x-goog-request-params: name=projects%2F${projectId}%2Fsecrets%2Fsecret-${uniqueId} | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"etag": "abcdef0123A=", | ||
"labels": { | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectNumber}/secrets/secret-${uniqueId}", | ||
"replication": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
tests/e2e/testdata/scenarios/secretmanagerversionalias/_http03.log
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,94 @@ | ||
PATCH https://secretmanager.googleapis.com/v1/projects/${projectId}/secrets/secret-${uniqueId}?%24alt=json%3Benum-encoding%3Dint&updateMask=versionAliases | ||
Content-Type: application/json | ||
User-Agent: kcc/controller-manager | ||
x-goog-request-params: secret.name=projects%2F${projectId}%2Fsecrets%2Fsecret-${uniqueId} | ||
|
||
{ | ||
"etag": "abcdef0123A=", | ||
"labels": { | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectId}/secrets/secret-${uniqueId}", | ||
"replication": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
}, | ||
"versionAliases": { | ||
"foo": "1" | ||
} | ||
} | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"etag": "abcdef0123A=", | ||
"labels": { | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectNumber}/secrets/secret-${uniqueId}", | ||
"replication": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
}, | ||
"versionAliases": { | ||
"foo": "1" | ||
} | ||
} | ||
|
||
--- | ||
|
||
GET https://secretmanager.googleapis.com/v1/projects/${projectId}/secrets/secret-${uniqueId}?alt=json | ||
Content-Type: application/json | ||
User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager | ||
|
||
200 OK | ||
Cache-Control: private | ||
Content-Type: application/json; charset=UTF-8 | ||
Server: ESF | ||
Vary: Origin | ||
Vary: X-Origin | ||
Vary: Referer | ||
X-Content-Type-Options: nosniff | ||
X-Frame-Options: SAMEORIGIN | ||
X-Xss-Protection: 0 | ||
|
||
{ | ||
"createTime": "2024-04-01T12:34:56.123456Z", | ||
"etag": "abcdef0123A=", | ||
"labels": { | ||
"managed-by-cnrm": "true" | ||
}, | ||
"name": "projects/${projectNumber}/secrets/secret-${uniqueId}", | ||
"replication": { | ||
"userManaged": { | ||
"replicas": [ | ||
{ | ||
"location": "us-central1" | ||
} | ||
] | ||
} | ||
}, | ||
"versionAliases": { | ||
"foo": "1" | ||
} | ||
} |
Oops, something went wrong.