Add edit command testcases

This commit is contained in:
Jordan Liggitt
2017-02-03 13:52:04 -05:00
parent 9af0dca52d
commit c43192c0c1
85 changed files with 2077 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:47Z
labels:
app: svc1modified
name: svc1
namespace: edit-test
resourceVersion: "2942"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 4149f70e-e9dc-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.118
ports:
- name: "81"
port: 82
protocol: TCP
targetPort: 81
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,28 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:47Z
labels:
app: svc1
name: svc1
namespace: edit-test
resourceVersion: "2942"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 4149f70e-e9dc-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.118
ports:
- name: "81"
port: 81
protocol: TCP
targetPort: 81
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,33 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "4149f70e-e9dc-11e6-8c3b-acbc32c1ca87",
"creationTimestamp": "2017-02-03T06:44:47Z",
"labels": {
"app": "svc1modified"
}
},
"spec": {
"ports": [
{
"name": "81",
"protocol": "TCP",
"port": 82,
"targetPort": 81
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "10.0.0.118",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,34 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "c07152b8-e9dc-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "3171",
"creationTimestamp": "2017-02-03T06:48:21Z",
"labels": {
"app": "svc1modified"
}
},
"spec": {
"ports": [
{
"name": "81",
"protocol": "TCP",
"port": 82,
"targetPort": 81
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "10.0.0.118",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,28 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:43Z
labels:
app: svc2modified
name: svc2
namespace: edit-test
resourceVersion: "2936"
selfLink: /api/v1/namespaces/edit-test/services/svc2
uid: 3e9b10db-e9dc-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.182.1
ports:
- name: "80"
port: 80
protocol: VHF
targetPort: 80
selector:
app: svc2
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,28 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:43Z
labels:
app: svc2
name: svc2
namespace: edit-test
resourceVersion: "2936"
selfLink: /api/v1/namespaces/edit-test/services/svc2
uid: 3e9b10db-e9dc-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.182
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 80
selector:
app: svc2
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,33 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc2",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc2",
"uid": "3e9b10db-e9dc-11e6-8c3b-acbc32c1ca87",
"creationTimestamp": "2017-02-03T06:44:43Z",
"labels": {
"app": "svc2modified"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "VHF",
"port": 80,
"targetPort": 80
}
],
"selector": {
"app": "svc2"
},
"clusterIP": "10.0.0.182.1",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,25 @@
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "Service \"svc2\" is invalid: [spec.ports[0].protocol: Unsupported value: \"VHF\": supported values: TCP, UDP, spec.clusterIP: Invalid value: \"10.0.0.182.1\": must be empty, 'None', or a valid IP address]",
"reason": "Invalid",
"details": {
"name": "svc2",
"kind": "Service",
"causes": [
{
"reason": "FieldValueNotSupported",
"message": "Unsupported value: \"VHF\": supported values: TCP, UDP",
"field": "spec.ports[0].protocol"
},
{
"reason": "FieldValueInvalid",
"message": "Invalid value: \"10.0.0.182.1\": must be empty, 'None', or a valid IP address",
"field": "spec.clusterIP"
}
]
},
"code": 422
}

View File

@@ -0,0 +1,54 @@
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:47Z
labels:
app: svc1
name: svc1
namespace: edit-test
resourceVersion: "2942"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 4149f70e-e9dc-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.118
ports:
- name: "81"
port: 81
protocol: TCP
targetPort: 81
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:44:43Z
labels:
app: svc2
name: svc2
namespace: edit-test
resourceVersion: "2936"
selfLink: /api/v1/namespaces/edit-test/services/svc2
uid: 3e9b10db-e9dc-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.182
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 80
selector:
app: svc2
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}
resourceVersion: ""
selfLink: ""

View File

@@ -0,0 +1,30 @@
description: create list with errors
mode: create
filename: "svc.yaml"
namespace: "edit-test"
expectedStdout:
- "service \"svc1\" created"
expectedStderr:
- "\"svc2\" is invalid"
expectedExitCode: 1
steps:
- type: edit
expectedInput: 0.original
resultingOutput: 0.edited
- type: request
expectedMethod: POST
expectedPath: /api/v1/namespaces/edit-test/services
expectedContentType: application/json
expectedInput: 1.request
resultingStatusCode: 201
resultingOutput: 1.response
- type: edit
expectedInput: 2.original
resultingOutput: 2.edited
- type: request
expectedMethod: POST
expectedPath: /api/v1/namespaces/edit-test/services
expectedContentType: application/json
expectedInput: 3.request
resultingStatusCode: 422
resultingOutput: 3.response

View File

@@ -0,0 +1,22 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
labels:
app: svc1
new-label: new-value
name: svc1
namespace: edit-test
spec:
ports:
- name: "81"
port: 82
protocol: TCP
targetPort: 81
selector:
app: svc1
sessionAffinity: None
type: ClusterIP

View File

@@ -0,0 +1,21 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
labels:
app: svc1
name: svc1
namespace: edit-test
spec:
ports:
- name: "81"
port: 81
protocol: TCP
targetPort: 81
selector:
app: svc1
sessionAffinity: None
type: ClusterIP

View File

@@ -0,0 +1,31 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"creationTimestamp": null,
"labels": {
"app": "svc1",
"new-label": "new-value"
}
},
"spec": {
"ports": [
{
"name": "81",
"protocol": "TCP",
"port": 82,
"targetPort": 81
}
],
"selector": {
"app": "svc1"
},
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "208b27ed-ea5b-11e6-9b42-acbc32c1ca87",
"resourceVersion": "1437",
"creationTimestamp": "2017-02-03T21:52:59Z",
"labels": {
"app": "svc1",
"new-label": "new-value"
}
},
"spec": {
"ports": [
{
"name": "81",
"protocol": "TCP",
"port": 82,
"targetPort": 81
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "10.0.0.15",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,22 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
labels:
app: svc2
name: svc2
namespace: edit-test
spec:
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 81
selector:
app: svc2
new-label: new-value
sessionAffinity: None
type: ClusterIP

View File

@@ -0,0 +1,21 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
labels:
app: svc2
name: svc2
namespace: edit-test
spec:
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 80
selector:
app: svc2
sessionAffinity: None
type: ClusterIP

View File

@@ -0,0 +1,31 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc2",
"namespace": "edit-test",
"creationTimestamp": null,
"labels": {
"app": "svc2"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 81
}
],
"selector": {
"app": "svc2",
"new-label": "new-value"
},
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc2",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc2",
"uid": "31a1b8ae-ea5b-11e6-9b42-acbc32c1ca87",
"resourceVersion": "1470",
"creationTimestamp": "2017-02-03T21:53:27Z",
"labels": {
"app": "svc2"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 81
}
],
"selector": {
"app": "svc2",
"new-label": "new-value"
},
"clusterIP": "10.0.0.55",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,39 @@
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
labels:
app: svc1
name: svc1
spec:
ports:
- name: "81"
port: 81
protocol: TCP
targetPort: 81
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: Service
metadata:
labels:
app: svc2
name: svc2
namespace: edit-test
spec:
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 80
selector:
app: svc2
sessionAffinity: None
type: ClusterIP
kind: List
metadata: {}
resourceVersion: ""
selfLink: ""

View File

@@ -0,0 +1,29 @@
description: edit while creating from a list
mode: create
filename: "svc.yaml"
namespace: "edit-test"
expectedStdout:
- service "svc1" created
- service "svc2" created
expectedExitCode: 0
steps:
- type: edit
expectedInput: 0.original
resultingOutput: 0.edited
- type: request
expectedMethod: POST
expectedPath: /api/v1/namespaces/edit-test/services
expectedContentType: application/json
expectedInput: 1.request
resultingStatusCode: 201
resultingOutput: 1.response
- type: edit
expectedInput: 2.original
resultingOutput: 2.edited
- type: request
expectedMethod: POST
expectedPath: /api/v1/namespaces/edit-test/services
expectedContentType: application/json
expectedInput: 3.request
resultingStatusCode: 201
resultingOutput: 3.response

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87",
"resourceVersion": "20820",
"creationTimestamp": "2017-02-01T21:14:09Z",
"labels": {
"app": "svc1",
"new-label": "new-value"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "10.0.0.146",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,29 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: edit-test
resourceVersion: "20820"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87
spec:
clusterIP: 10.0.0.146.1
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,29 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: edit-test
resourceVersion: "20820"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87
spec:
clusterIP: 10.0.0.146
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,5 @@
{
"spec": {
"clusterIP": "10.0.0.146.1"
}
}

View File

@@ -0,0 +1,25 @@
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "Service \"svc1\" is invalid: [spec.clusterIP: Invalid value: \"10.0.0.146.1\": field is immutable, spec.clusterIP: Invalid value: \"10.0.0.146.1\": must be empty, 'None', or a valid IP address]",
"reason": "Invalid",
"details": {
"name": "svc1",
"kind": "Service",
"causes": [
{
"reason": "FieldValueInvalid",
"message": "Invalid value: \"10.0.0.146.1\": field is immutable",
"field": "spec.clusterIP"
},
{
"reason": "FieldValueInvalid",
"message": "Invalid value: \"10.0.0.146.1\": must be empty, 'None', or a valid IP address",
"field": "spec.clusterIP"
}
]
},
"code": 422
}

View File

@@ -0,0 +1,33 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# services "svc1" was not valid:
# * spec.clusterIP: Invalid value: "10.0.0.146.1": field is immutable
# * spec.clusterIP: Invalid value: "10.0.0.146.1": must be empty, 'None', or a valid IP address
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: edit-test
resourceVersion: "20820"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87
spec:
clusterIP: 10.0.0.146
ports:
- name: "80"
port: 82
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,33 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# services "svc1" was not valid:
# * spec.clusterIP: Invalid value: "10.0.0.146.1": field is immutable
# * spec.clusterIP: Invalid value: "10.0.0.146.1": must be empty, 'None', or a valid IP address
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: edit-test
resourceVersion: "20820"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87
spec:
clusterIP: 10.0.0.146.1
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,16 @@
{
"spec": {
"ports": [
{
"$patch": "delete",
"port": 81
},
{
"name": "80",
"port": 82,
"protocol": "TCP",
"targetPort": 80
}
]
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87",
"resourceVersion": "21361",
"creationTimestamp": "2017-02-01T21:14:09Z",
"labels": {
"app": "svc1",
"new-label": "new-value"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 82,
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "10.0.0.146",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,38 @@
description: add a testcase description
mode: edit
args:
- service
- svc1
namespace: edit-test
expectedStdout:
- service "svc1" edited
expectedStderr:
- "error: services \"svc1\" is invalid"
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: edit
expectedInput: 1.original
resultingOutput: 1.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 2.request
resultingStatusCode: 422
resultingOutput: 2.response
- type: edit
expectedInput: 3.original
resultingOutput: 3.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 4.request
resultingStatusCode: 200
resultingOutput: 4.response

View File

@@ -0,0 +1,24 @@
{
"kind": "ConfigMapList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/edit-test/configmaps",
"resourceVersion": "2308"
},
"items": [
{
"metadata": {
"name": "cm1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/configmaps/cm1",
"uid": "b09bffab-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "2071",
"creationTimestamp": "2017-02-03T06:12:07Z"
},
"data": {
"baz": "qux",
"foo": "changed-value2"
}
}
]
}

View File

@@ -0,0 +1,16 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
baz: qux
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1-modified
namespace: edit-test
resourceVersion: "2071"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87

View File

@@ -0,0 +1,16 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
baz: qux
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "2071"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87

View File

@@ -0,0 +1,18 @@
description: try to mutate a fixed field
mode: edit
args:
- configmap
namespace: "edit-test"
expectedStderr:
- At least one of apiVersion, kind and name was changed
expectedExitCode: 1
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/configmaps
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: edit
expectedInput: 1.original
resultingOutput: 1.edited

View File

View File

@@ -0,0 +1,24 @@
{
"kind": "ConfigMapList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/edit-test/configmaps",
"resourceVersion": "1934"
},
"items": [
{
"metadata": {
"name": "cm1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/configmaps/cm1",
"uid": "b09bffab-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "1903",
"creationTimestamp": "2017-02-03T06:12:07Z"
},
"data": {
"baz": "qux",
"foo": "changed-value"
}
}
]
}

View File

View File

@@ -0,0 +1,39 @@
{
"kind": "ServiceList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/edit-test/services",
"resourceVersion": "1934"
},
"items": [
{
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "9bec82be-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "1904",
"creationTimestamp": "2017-02-03T06:11:32Z",
"labels": {
"app": "svc1"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 82,
"targetPort": 81
}
],
"clusterIP": "10.0.0.248",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}
]
}

View File

@@ -0,0 +1,5 @@
{
"data": {
"foo": "changed-value2"
}
}

View File

@@ -0,0 +1,16 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/configmaps/cm1",
"uid": "b09bffab-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "2071",
"creationTimestamp": "2017-02-03T06:12:07Z"
},
"data": {
"baz": "qux",
"foo": "changed-value2"
}
}

View File

@@ -0,0 +1,42 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
name: svc1
namespace: edit-test
resourceVersion: "1904"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.10
ports:
- name: "80"
port: 82
protocol: VHF
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
data:
baz: qux
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1903"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
kind: List
metadata: {}

View File

@@ -0,0 +1,42 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
items:
- apiVersion: v1
data:
baz: qux
foo: changed-value
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1903"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
name: svc1
namespace: edit-test
resourceVersion: "1904"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.248
ports:
- name: "80"
port: 82
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,11 @@
{
"spec": {
"clusterIP": "10.0.0.10",
"ports": [
{
"port": 82,
"protocol": "VHF"
}
]
}
}

View File

@@ -0,0 +1,25 @@
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "Service \"svc1\" is invalid: [spec.clusterIP: Invalid value: \"10.0.0.10\": field is immutable, spec.ports[0].protocol: Unsupported value: \"VHF\": supported values: TCP, UDP]",
"reason": "Invalid",
"details": {
"name": "svc1",
"kind": "Service",
"causes": [
{
"reason": "FieldValueInvalid",
"message": "Invalid value: \"10.0.0.10\": field is immutable",
"field": "spec.clusterIP"
},
{
"reason": "FieldValueNotSupported",
"message": "Unsupported value: \"VHF\": supported values: TCP, UDP",
"field": "spec.ports[0].protocol"
}
]
},
"code": 422
}

View File

@@ -0,0 +1,5 @@
{
"data": {
"foo": "changed-value2"
}
}

View File

@@ -0,0 +1,16 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/configmaps/cm1",
"uid": "b09bffab-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "2017",
"creationTimestamp": "2017-02-03T06:12:07Z"
},
"data": {
"baz": "qux",
"foo": "changed-value2"
}
}

View File

@@ -0,0 +1,47 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# services "svc1" was not valid:
# * spec.clusterIP: Invalid value: "10.0.0.10": field is immutable
# * spec.ports[0].protocol: Unsupported value: "VHF": supported values: TCP, UDP
#
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
newvalue: modified
name: svc1
namespace: edit-test
resourceVersion: "1904"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.248
ports:
- name: "80"
port: 83
protocol: VHF
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
data:
baz: qux
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1903"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
kind: List
metadata: {}

View File

@@ -0,0 +1,46 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# services "svc1" was not valid:
# * spec.clusterIP: Invalid value: "10.0.0.10": field is immutable
# * spec.ports[0].protocol: Unsupported value: "VHF": supported values: TCP, UDP
#
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
name: svc1
namespace: edit-test
resourceVersion: "1904"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.10
ports:
- name: "80"
port: 82
protocol: VHF
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
data:
baz: qux
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1903"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
kind: List
metadata: {}

View File

@@ -0,0 +1,21 @@
{
"metadata": {
"labels": {
"newvalue": "modified"
}
},
"spec": {
"ports": [
{
"$patch": "delete",
"port": 82
},
{
"name": "80",
"port": 83,
"protocol": "VHF",
"targetPort": 81
}
]
}
}

View File

@@ -0,0 +1,20 @@
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "Service \"svc1\" is invalid: spec.ports[0].protocol: Unsupported value: \"VHF\": supported values: TCP, UDP",
"reason": "Invalid",
"details": {
"name": "svc1",
"kind": "Service",
"causes": [
{
"reason": "FieldValueNotSupported",
"message": "Unsupported value: \"VHF\": supported values: TCP, UDP",
"field": "spec.ports[0].protocol"
}
]
},
"code": 422
}

View File

@@ -0,0 +1,5 @@
{
"data": {
"foo": "changed-value2"
}
}

View File

@@ -0,0 +1,16 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/configmaps/cm1",
"uid": "b09bffab-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "2017",
"creationTimestamp": "2017-02-03T06:12:07Z"
},
"data": {
"baz": "qux",
"foo": "changed-value2"
}
}

View File

@@ -0,0 +1,46 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# services "svc1" was not valid:
# * spec.ports[0].protocol: Unsupported value: "VHF": supported values: TCP, UDP
#
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
newvalue: modified
name: svc1
namespace: edit-test
resourceVersion: "1904"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.248
ports:
- name: "80"
port: 83
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
data:
baz: qux
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1903"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
kind: List
metadata: {}

View File

@@ -0,0 +1,46 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# services "svc1" was not valid:
# * spec.ports[0].protocol: Unsupported value: "VHF": supported values: TCP, UDP
#
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
newvalue: modified
name: svc1
namespace: edit-test
resourceVersion: "1904"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.248
ports:
- name: "80"
port: 83
protocol: VHF
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
data:
baz: qux
foo: changed-value2
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1903"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
kind: List
metadata: {}

View File

@@ -0,0 +1,21 @@
{
"metadata": {
"labels": {
"newvalue": "modified"
}
},
"spec": {
"ports": [
{
"$patch": "delete",
"port": 82
},
{
"name": "80",
"port": 83,
"protocol": "TCP",
"targetPort": 81
}
]
}
}

View File

@@ -0,0 +1,32 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "9bec82be-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "2070",
"creationTimestamp": "2017-02-03T06:11:32Z",
"labels": {
"app": "svc1",
"newvalue": "modified"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 83,
"targetPort": 81
}
],
"clusterIP": "10.0.0.248",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,73 @@
description: edit lists with errors and resubmit
mode: edit
args:
- configmaps,services
namespace: "edit-test"
expectedStdout:
- configmap "cm1" edited
- service "svc1" edited
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/configmaps
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/services
expectedInput: 1.request
resultingStatusCode: 200
resultingOutput: 1.response
- type: edit
expectedInput: 2.original
resultingOutput: 2.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 3.request
resultingStatusCode: 422
resultingOutput: 3.response
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/configmaps/cm1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 4.request
resultingStatusCode: 200
resultingOutput: 4.response
- type: edit
expectedInput: 5.original
resultingOutput: 5.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 6.request
resultingStatusCode: 422
resultingOutput: 6.response
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/configmaps/cm1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 7.request
resultingStatusCode: 200
resultingOutput: 7.response
- type: edit
expectedInput: 8.original
resultingOutput: 8.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 9.request
resultingStatusCode: 200
resultingOutput: 9.response
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/configmaps/cm1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 10.request
resultingStatusCode: 200
resultingOutput: 10.response

View File

View File

@@ -0,0 +1,18 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/configmaps/cm1",
"uid": "b09bffab-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "1414",
"creationTimestamp": "2017-02-03T06:12:07Z"
},
"data": {
"baz": "qux",
"foo": "changed-value",
"new-data": "new-value",
"new-data2": "new-value"
}
}

View File

View File

@@ -0,0 +1,32 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "9bec82be-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "1064",
"creationTimestamp": "2017-02-03T06:11:32Z",
"labels": {
"app": "svc1",
"new-label": "foo"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 81
}
],
"clusterIP": "10.0.0.248",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,47 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
items:
- apiVersion: v1
data:
baz: qux
foo: changed-value
new-data: new-value
new-data2: new-value
new-data3: newivalue
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1414"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
new-label: foo
new-label2: foo2
name: svc1
namespace: edit-test
resourceVersion: "1064"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.248
ports:
- name: "80"
port: 82
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,45 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
items:
- apiVersion: v1
data:
baz: qux
foo: changed-value
new-data: new-value
new-data2: new-value
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T06:12:07Z
name: cm1
namespace: edit-test
resourceVersion: "1414"
selfLink: /api/v1/namespaces/edit-test/configmaps/cm1
uid: b09bffab-e9d7-11e6-8c3b-acbc32c1ca87
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-03T06:11:32Z
labels:
app: svc1
new-label: foo
name: svc1
namespace: edit-test
resourceVersion: "1064"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 9bec82be-e9d7-11e6-8c3b-acbc32c1ca87
spec:
clusterIP: 10.0.0.248
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,5 @@
{
"data": {
"new-data3": "newivalue"
}
}

View File

@@ -0,0 +1,19 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/configmaps/cm1",
"uid": "b09bffab-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "1465",
"creationTimestamp": "2017-02-03T06:12:07Z"
},
"data": {
"baz": "qux",
"foo": "changed-value",
"new-data": "new-value",
"new-data2": "new-value",
"new-data3": "newivalue"
}
}

View File

@@ -0,0 +1,21 @@
{
"metadata": {
"labels": {
"new-label2": "foo2"
}
},
"spec": {
"ports": [
{
"$patch": "delete",
"port": 81
},
{
"name": "80",
"port": 82,
"protocol": "TCP",
"targetPort": 81
}
]
}
}

View File

@@ -0,0 +1,33 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "9bec82be-e9d7-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "1466",
"creationTimestamp": "2017-02-03T06:11:32Z",
"labels": {
"app": "svc1",
"new-label": "foo",
"new-label2": "foo2"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 82,
"targetPort": 81
}
],
"clusterIP": "10.0.0.248",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,40 @@
description: add a testcase description
mode: edit
args:
- configmaps/cm1
- service/svc1
namespace: "edit-test"
expectedStdout:
- configmap "cm1" edited
- service "svc1" edited
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/configmaps/cm1
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedInput: 1.request
resultingStatusCode: 200
resultingOutput: 1.response
- type: edit
expectedInput: 2.original
resultingOutput: 2.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/configmaps/cm1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 3.request
resultingStatusCode: 200
resultingOutput: 3.response
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 4.request
resultingStatusCode: 200
resultingOutput: 4.response

View File

@@ -0,0 +1,13 @@
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "services \"missing\" not found",
"reason": "NotFound",
"details": {
"name": "missing",
"kind": "services"
},
"code": 404
}

View File

@@ -0,0 +1,15 @@
description: add a testcase description
mode: edit
args:
- service/missing
namespace: "default"
expectedStderr:
- services "missing" not found
expectedExitCode: 1
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/default/services/missing
expectedInput: 0.request
resultingStatusCode: 404
resultingOutput: 0.response

View File

View File

@@ -0,0 +1,12 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "mymap",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/configmaps/mymap",
"uid": "dbde42e9-e9d5-11e6-8c3b-acbc32c1ca87",
"resourceVersion": "149",
"creationTimestamp": "2017-02-03T05:59:00Z"
}
}

View File

@@ -0,0 +1,13 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T05:59:00Z
name: mymap
namespace: default
resourceVersion: "149"
selfLink: /api/v1/namespaces/default/configmaps/mymap
uid: dbde42e9-e9d5-11e6-8c3b-acbc32c1ca87

View File

@@ -0,0 +1,13 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: ConfigMap
metadata:
creationTimestamp: 2017-02-03T05:59:00Z
name: mymap
namespace: default
resourceVersion: "149"
selfLink: /api/v1/namespaces/default/configmaps/mymap
uid: dbde42e9-e9d5-11e6-8c3b-acbc32c1ca87

View File

@@ -0,0 +1,18 @@
description: no-op edit
mode: edit
args:
- configmap/mymap
namespace: "default"
expectedStderr:
- Edit cancelled, no changes made.
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/default/configmaps/mymap
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: edit
expectedInput: 1.original
resultingOutput: 1.edited

View File

@@ -0,0 +1,34 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87",
"resourceVersion": "20715",
"creationTimestamp": "2017-02-01T21:14:09Z",
"labels": {
"app": "svc1"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "10.0.0.146",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,29 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: edit-test
resourceVersion: "20715"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87
spec:
clusterIP: 10.0.0.146
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,28 @@
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
name: svc1
namespace: edit-test
resourceVersion: "20715"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: 5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87
spec:
clusterIP: 10.0.0.146
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,21 @@
{
"metadata": {
"labels": {
"new-label": "new-value"
}
},
"spec": {
"ports": [
{
"$patch": "delete",
"port": 80
},
{
"name": "80",
"port": 81,
"protocol": "TCP",
"targetPort": 80
}
]
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "5f7da8db-e8c3-11e6-b7e2-acbc32c1ca87",
"resourceVersion": "20820",
"creationTimestamp": "2017-02-01T21:14:09Z",
"labels": {
"app": "svc1",
"new-label": "new-value"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "10.0.0.146",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,29 @@
# kubectl create namespace edit-test
# kubectl create service clusterip svc1 --tcp 80 --namespace=edit-test
# kubectl edit service svc1 --namespace=edit-test
description: edit a single service, add a label and change a port
mode: edit
args:
- service
- svc1
namespace: edit-test
expectedStdout:
- service "svc1" edited
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: edit
expectedInput: 1.original
resultingOutput: 1.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/edit-test/services/svc1
expectedContentType: application/strategic-merge-patch+json
expectedInput: 2.request
resultingStatusCode: 200
resultingOutput: 2.response