-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: format golden output as multi-line JSON
Not (yet) applying this everywhere to keep the changes reasonable, but for our new tests it is much easier to read.
- Loading branch information
Showing
20 changed files
with
476 additions
and
129 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
196 changes: 189 additions & 7 deletions
196
mockkubeapiserver/tests/testdata/configmap/expected.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 |
---|---|---|
@@ -1,44 +1,226 @@ | ||
GET http://kube-apiserver/api/v1 | ||
Accept: application/json, */* | ||
|
||
|
||
200 OK | ||
Cache-Control: no-cache, private | ||
Content-Length: 1820 | ||
Content-Type: application/json | ||
Date: (removed) | ||
|
||
{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"v1","resources":[{"name":"componentstatuses","singularName":"","namespaced":false,"version":"v1","kind":"ComponentStatus","verbs":null},{"name":"configmaps","singularName":"","namespaced":true,"version":"v1","kind":"ConfigMap","verbs":null},{"name":"endpoints","singularName":"","namespaced":true,"version":"v1","kind":"Endpoints","verbs":null},{"name":"events","singularName":"","namespaced":true,"version":"v1","kind":"Event","verbs":null},{"name":"limitranges","singularName":"","namespaced":true,"version":"v1","kind":"LimitRange","verbs":null},{"name":"namespaces","singularName":"","namespaced":false,"version":"v1","kind":"Namespace","verbs":null},{"name":"nodes","singularName":"","namespaced":false,"version":"v1","kind":"Node","verbs":null},{"name":"persistentvolumes","singularName":"","namespaced":false,"version":"v1","kind":"PersistentVolume","verbs":null},{"name":"persistentvolumeclaims","singularName":"","namespaced":true,"version":"v1","kind":"PersistentVolumeClaim","verbs":null},{"name":"pods","singularName":"","namespaced":true,"version":"v1","kind":"Pod","verbs":null},{"name":"podtemplates","singularName":"","namespaced":true,"version":"v1","kind":"PodTemplate","verbs":null},{"name":"replicationcontrollers","singularName":"","namespaced":true,"version":"v1","kind":"ReplicationController","verbs":null},{"name":"resourcequotas","singularName":"","namespaced":true,"version":"v1","kind":"ResourceQuota","verbs":null},{"name":"secrets","singularName":"","namespaced":true,"version":"v1","kind":"Secret","verbs":null},{"name":"services","singularName":"","namespaced":true,"version":"v1","kind":"Service","verbs":null},{"name":"serviceaccounts","singularName":"","namespaced":true,"version":"v1","kind":"ServiceAccount","verbs":null}]} | ||
{ | ||
"apiVersion": "v1", | ||
"groupVersion": "v1", | ||
"kind": "APIResourceList", | ||
"resources": [ | ||
{ | ||
"kind": "ComponentStatus", | ||
"name": "componentstatuses", | ||
"namespaced": false, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "ConfigMap", | ||
"name": "configmaps", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "Endpoints", | ||
"name": "endpoints", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "Event", | ||
"name": "events", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "LimitRange", | ||
"name": "limitranges", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "Namespace", | ||
"name": "namespaces", | ||
"namespaced": false, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "Node", | ||
"name": "nodes", | ||
"namespaced": false, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "PersistentVolume", | ||
"name": "persistentvolumes", | ||
"namespaced": false, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "PersistentVolumeClaim", | ||
"name": "persistentvolumeclaims", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "Pod", | ||
"name": "pods", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "PodTemplate", | ||
"name": "podtemplates", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "ReplicationController", | ||
"name": "replicationcontrollers", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "ResourceQuota", | ||
"name": "resourcequotas", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "Secret", | ||
"name": "secrets", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "Service", | ||
"name": "services", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
}, | ||
{ | ||
"kind": "ServiceAccount", | ||
"name": "serviceaccounts", | ||
"namespaced": true, | ||
"singularName": "", | ||
"verbs": null, | ||
"version": "v1" | ||
} | ||
] | ||
} | ||
|
||
--- | ||
|
||
PATCH http://kube-apiserver/api/v1/namespaces/default?fieldManager=test&force=false | ||
Accept: application/json | ||
Content-Type: application/apply-patch+yaml | ||
|
||
{"apiVersion":"v1","kind":"Namespace","metadata":{"name":"default"}} | ||
|
||
{ | ||
"apiVersion": "v1", | ||
"kind": "Namespace", | ||
"metadata": { | ||
"name": "default" | ||
} | ||
} | ||
|
||
200 OK | ||
Cache-Control: no-cache, private | ||
Content-Length: 294 | ||
Content-Type: application/json | ||
Date: (removed) | ||
|
||
{"apiVersion":"v1","kind":"Namespace","metadata":{"creationTimestamp":"2022-01-01T00:00:00Z","labels":{"kubernetes.io/metadata.name":"default"},"name":"default","resourceVersion":"1","uid":"00000000-0000-0000-0000-000000000001"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}} | ||
{ | ||
"apiVersion": "v1", | ||
"kind": "Namespace", | ||
"metadata": { | ||
"creationTimestamp": "2022-01-01T00:00:00Z", | ||
"labels": { | ||
"kubernetes.io/metadata.name": "default" | ||
}, | ||
"name": "default", | ||
"resourceVersion": "1", | ||
"uid": "00000000-0000-0000-0000-000000000001" | ||
}, | ||
"spec": { | ||
"finalizers": [ | ||
"kubernetes" | ||
] | ||
}, | ||
"status": { | ||
"phase": "Active" | ||
} | ||
} | ||
|
||
--- | ||
|
||
PATCH http://kube-apiserver/api/v1/namespaces/default/configmaps/config?fieldManager=test&force=false | ||
Accept: application/json | ||
Content-Type: application/apply-patch+yaml | ||
|
||
{"apiVersion":"v1","data":{"foo":"bar"},"kind":"ConfigMap","metadata":{"name":"config","namespace":"default"}} | ||
|
||
{ | ||
"apiVersion": "v1", | ||
"data": { | ||
"foo": "bar" | ||
}, | ||
"kind": "ConfigMap", | ||
"metadata": { | ||
"name": "config", | ||
"namespace": "default" | ||
} | ||
} | ||
|
||
200 OK | ||
Cache-Control: no-cache, private | ||
Content-Length: 220 | ||
Content-Type: application/json | ||
Date: (removed) | ||
|
||
{"apiVersion":"v1","data":{"foo":"bar"},"kind":"ConfigMap","metadata":{"creationTimestamp":"2022-01-01T00:00:01Z","name":"config","namespace":"default","resourceVersion":"2","uid":"00000000-0000-0000-0000-000000000002"}} | ||
{ | ||
"apiVersion": "v1", | ||
"data": { | ||
"foo": "bar" | ||
}, | ||
"kind": "ConfigMap", | ||
"metadata": { | ||
"creationTimestamp": "2022-01-01T00:00:01Z", | ||
"name": "config", | ||
"namespace": "default", | ||
"resourceVersion": "2", | ||
"uid": "00000000-0000-0000-0000-000000000002" | ||
} | ||
} |
Oops, something went wrong.