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

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