Skip to content

Commit

Permalink
Add back tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpang777 committed Dec 30, 2024
1 parent 61f0f9c commit fb88c51
Show file tree
Hide file tree
Showing 8 changed files with 880 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: securesourcemanager.cnrm.cloud.google.com/v1alpha1
kind: SecureSourceManagerRepository
metadata:
finalizers:
- cnrm.cloud.google.com/finalizer
- cnrm.cloud.google.com/deletion-defender
generation: 1
labels:
cnrm-test: "true"
name: ssmrepository-${uniqueId}
namespace: ${uniqueId}
spec:
instanceRef:
name: ssminstance-dep-${uniqueId}
location: us-central1
projectRef:
external: ${projectId}
status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: The resource is up to date
reason: UpToDate
status: "True"
type: Ready
externalRef: projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}
observedGeneration: 1
observedState:
uris:
api: https://ssminstance-dep-${uniqueId}-${projectNumber}-api.us-central1.sourcemanager.dev/v1/projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}
gitHTTPS: https://ssminstance-dep-${uniqueId}-${projectNumber}-git.us-central1.sourcemanager.dev/${projectId}/ssmrepository-${uniqueId}.git
html: https://ssminstance-dep-${uniqueId}-${projectNumber}.us-central1.sourcemanager.dev/${projectId}/ssmrepository-${uniqueId}
Original file line number Diff line number Diff line change
@@ -0,0 +1,353 @@
GET https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}?%24alt=json%3Benum-encoding%3Dint
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Finstances%2Fssminstance-dep-${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,
"message": "Resource 'projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}' was not found",
"status": "NOT_FOUND"
}
}

---

POST https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/instances?%24alt=json%3Benum-encoding%3Dint&instanceId=ssminstance-dep-${uniqueId}
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: parent=projects%2F${projectId}%2Flocations%2Fus-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

{
"metadata": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata",
"apiVersion": "v1",
"createTime": "2024-04-01T12:34:56.123456Z",
"target": "projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"verb": "create"
},
"name": "projects/${projectId}/locations/us-central1/operations/${operationID}"
}

---

GET https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/operations/${operationID}
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Foperations%2F${operationID}

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

{
"done": true,
"metadata": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata",
"apiVersion": "v1",
"createTime": "2024-04-01T12:34:56.123456Z",
"endTime": "2024-04-01T12:34:56.123456Z",
"target": "projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"verb": "create"
},
"name": "projects/${projectId}/locations/us-central1/operations/${operationID}",
"response": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.Instance",
"createTime": "2024-04-01T12:34:56.123456Z",
"hostConfig": {
"api": "ssminstance-dep-${uniqueId}-${projectNumber}-api.us-central1.sourcemanager.dev",
"gitHttp": "ssminstance-dep-${uniqueId}-${projectNumber}-git.us-central1.sourcemanager.dev",
"gitSsh": "ssminstance-dep-${uniqueId}-${projectNumber}-ssh.us-central1.sourcemanager.dev",
"html": "ssminstance-dep-${uniqueId}-${projectNumber}.us-central1.sourcemanager.dev"
},
"name": "projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"state": "ACTIVE",
"updateTime": "2024-04-01T12:34:56.123456Z"
}
}

---

GET https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}?%24alt=json%3Benum-encoding%3Dint
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Frepositories%2Fssmrepository-${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,
"message": "Resource \"projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}\" was not found",
"status": "NOT_FOUND"
}
}

---

GET https://cloudresourcemanager.googleapis.com/v3/projects/${projectId}?%24alt=json%3Benum-encoding%3Dint
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}

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}",
"projectId": "${projectId}",
"state": 1
}

---

POST https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/repositories?%24alt=json%3Benum-encoding%3Dint&repositoryId=ssmrepository-${uniqueId}
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: parent=projects%2F${projectId}%2Flocations%2Fus-central1

{
"instance": "projects/${projectNumber}/locations/us-central1/instances/ssminstance-dep-${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

{
"done": true,
"metadata": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata",
"apiVersion": "v1",
"createTime": "2024-04-01T12:34:56.123456Z",
"endTime": "2024-04-01T12:34:56.123456Z",
"target": "projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}",
"verb": "create"
},
"name": "operations/${operationID}",
"response": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.Repository",
"createTime": "2024-04-01T12:34:56.123456Z",
"instance": "projects/${projectNumber}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"name": "projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}",
"uris": {
"api": "https://ssminstance-dep-${uniqueId}-${projectNumber}-api.us-central1.sourcemanager.dev/v1/projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}",
"gitHttps": "https://ssminstance-dep-${uniqueId}-${projectNumber}-git.us-central1.sourcemanager.dev/${projectId}/ssmrepository-${uniqueId}.git",
"html": "https://ssminstance-dep-${uniqueId}-${projectNumber}.us-central1.sourcemanager.dev/${projectId}/ssmrepository-${uniqueId}"
}
}
}

---

GET https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}?%24alt=json%3Benum-encoding%3Dint
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Frepositories%2Fssmrepository-${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",
"instance": "projects/${projectNumber}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"name": "projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}",
"uris": {
"api": "https://ssminstance-dep-${uniqueId}-${projectNumber}-api.us-central1.sourcemanager.dev/v1/projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}",
"gitHttps": "https://ssminstance-dep-${uniqueId}-${projectNumber}-git.us-central1.sourcemanager.dev/${projectId}/ssmrepository-${uniqueId}.git",
"html": "https://ssminstance-dep-${uniqueId}-${projectNumber}.us-central1.sourcemanager.dev/${projectId}/ssmrepository-${uniqueId}"
}
}

---

DELETE https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}?%24alt=json%3Benum-encoding%3Dint
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Frepositories%2Fssmrepository-${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

{
"done": true,
"metadata": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata",
"apiVersion": "v1",
"createTime": "2024-04-01T12:34:56.123456Z",
"endTime": "2024-04-01T12:34:56.123456Z",
"target": "projects/${projectId}/locations/us-central1/repositories/ssmrepository-${uniqueId}",
"verb": "delete"
},
"name": "operations/${operationID}",
"response": {
"@type": "type.googleapis.com/google.protobuf.Empty"
}
}

---

GET https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}?%24alt=json%3Benum-encoding%3Dint
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Finstances%2Fssminstance-dep-${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",
"hostConfig": {
"api": "ssminstance-dep-${uniqueId}-${projectNumber}-api.us-central1.sourcemanager.dev",
"gitHttp": "ssminstance-dep-${uniqueId}-${projectNumber}-git.us-central1.sourcemanager.dev",
"gitSsh": "ssminstance-dep-${uniqueId}-${projectNumber}-ssh.us-central1.sourcemanager.dev",
"html": "ssminstance-dep-${uniqueId}-${projectNumber}.us-central1.sourcemanager.dev"
},
"name": "projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"state": 2,
"updateTime": "2024-04-01T12:34:56.123456Z"
}

---

DELETE https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}?%24alt=json%3Benum-encoding%3Dint
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Finstances%2Fssminstance-dep-${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

{
"metadata": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata",
"apiVersion": "v1",
"createTime": "2024-04-01T12:34:56.123456Z",
"target": "projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"verb": "delete"
},
"name": "projects/${projectId}/locations/us-central1/operations/${operationID}"
}

---

GET https://securesourcemanager.googleapis.com/v1/projects/${projectId}/locations/us-central1/operations/${operationID}
Content-Type: application/json
User-Agent: kcc/controller-manager
x-goog-request-params: name=projects%2F${projectId}%2Flocations%2Fus-central1%2Foperations%2F${operationID}

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

{
"done": true,
"metadata": {
"@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata",
"apiVersion": "v1",
"createTime": "2024-04-01T12:34:56.123456Z",
"endTime": "2024-04-01T12:34:56.123456Z",
"target": "projects/${projectId}/locations/us-central1/instances/ssminstance-dep-${uniqueId}",
"verb": "delete"
},
"name": "projects/${projectId}/locations/us-central1/operations/${operationID}",
"response": {
"@type": "type.googleapis.com/google.protobuf.Empty"
}
}
Loading

0 comments on commit fb88c51

Please sign in to comment.