Add generated file

This PR adds generated files under pkg/client and vendor folder.
This commit is contained in:
xing-yang
2018-07-12 10:55:15 -07:00
parent 36b1de0341
commit e213d1890d
17729 changed files with 5090889 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "edit",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
go_library(
name = "go_default_library",
srcs = ["record.go"],
importpath = "k8s.io/kubernetes/pkg/kubectl/cmd/testdata/edit",
visibility = ["//visibility:private"],
deps = ["//vendor/gopkg.in/yaml.v2:go_default_library"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = [
"//build/visible_to:pkg_kubectl_cmd_testdata_edit_CONSUMERS",
],
)

View File

@@ -0,0 +1,22 @@
This folder contains test cases for interactive edit, and helpers for recording new test cases
To record a new test:
1. Start a local cluster running unsecured on http://localhost:8080 (e.g. hack/local-up-cluster.sh)
2. Set up any pre-existing resources you want to be available on that server (namespaces, resources to edit, etc)
3. Run ./pkg/kubectl/cmd/testdata/edit/record_testcase.sh my-testcase
4. Run the desired `kubectl edit ...` command, and interact with the editor as desired until it completes.
* You can do things that cause errors to appear in the editor (change immutable fields, fail validation, etc)
* You can perform edit flows that invoke the editor multiple times
* You can make out-of-band changes to the server resources that cause conflict errors to be returned
* The API requests/responses and editor inputs/outputs are captured in your testcase folder
5. Type exit.
6. Inspect the captured requests/responses and inputs/outputs for sanity
7. Modify the generated test.yaml file:
* Set a description of what the test is doing
* Enter the args (if any) you invoked edit with
* Enter the filename (if any) you invoked edit with
* Enter the output format (if any) you invoked edit with
* Optionally specify substrings to look for in the stdout or stderr of the edit command
8. Add your new testcase name to the list of testcases in edit_test.go
9. Run `go test ./pkg/kubectl/cmd -run TestEdit -v` to run edit tests

View File

@@ -0,0 +1,169 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
yaml "gopkg.in/yaml.v2"
)
type EditTestCase struct {
Description string `yaml:"description"`
// create or edit
Mode string `yaml:"mode"`
Args []string `yaml:"args"`
Filename string `yaml:"filename"`
Output string `yaml:"outputFormat"`
Namespace string `yaml:"namespace"`
ExpectedStdout []string `yaml:"expectedStdout"`
ExpectedStderr []string `yaml:"expectedStderr"`
ExpectedExitCode int `yaml:"expectedExitCode"`
Steps []EditStep `yaml:"steps"`
}
type EditStep struct {
// edit or request
StepType string `yaml:"type"`
// only applies to request
RequestMethod string `yaml:"expectedMethod,omitempty"`
RequestPath string `yaml:"expectedPath,omitempty"`
RequestContentType string `yaml:"expectedContentType,omitempty"`
Input string `yaml:"expectedInput"`
// only applies to request
ResponseStatusCode int `yaml:"resultingStatusCode,omitempty"`
Output string `yaml:"resultingOutput"`
}
func main() {
tc := &EditTestCase{
Description: "add a testcase description",
Mode: "edit",
Args: []string{"set", "args"},
ExpectedStdout: []string{"expected stdout substring"},
ExpectedStderr: []string{"expected stderr substring"},
}
var currentStep *EditStep
fmt.Println(http.ListenAndServe(":8081", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
// Record non-discovery things
record := false
switch segments := strings.Split(strings.Trim(req.URL.Path, "/"), "/"); segments[0] {
case "api":
// api, version
record = len(segments) > 2
case "apis":
// apis, group, version
record = len(segments) > 3
case "callback":
record = true
}
body, err := ioutil.ReadAll(req.Body)
checkErr(err)
switch m, p := req.Method, req.URL.Path; {
case m == "POST" && p == "/callback/in":
if currentStep != nil {
panic("cannot post input with step already in progress")
}
filename := fmt.Sprintf("%d.original", len(tc.Steps))
checkErr(ioutil.WriteFile(filename, body, os.FileMode(0755)))
currentStep = &EditStep{StepType: "edit", Input: filename}
case m == "POST" && p == "/callback/out":
if currentStep == nil || currentStep.StepType != "edit" {
panic("cannot post output without posting input first")
}
filename := fmt.Sprintf("%d.edited", len(tc.Steps))
checkErr(ioutil.WriteFile(filename, body, os.FileMode(0755)))
currentStep.Output = filename
tc.Steps = append(tc.Steps, *currentStep)
currentStep = nil
default:
if currentStep != nil {
panic("cannot make request with step already in progress")
}
urlCopy := *req.URL
urlCopy.Host = "localhost:8080"
urlCopy.Scheme = "http"
proxiedReq, err := http.NewRequest(req.Method, urlCopy.String(), bytes.NewReader(body))
checkErr(err)
proxiedReq.Header = req.Header
resp, err := http.DefaultClient.Do(proxiedReq)
checkErr(err)
defer resp.Body.Close()
bodyOut, err := ioutil.ReadAll(resp.Body)
checkErr(err)
for k, vs := range resp.Header {
for _, v := range vs {
w.Header().Add(k, v)
}
}
w.WriteHeader(resp.StatusCode)
w.Write(bodyOut)
if record {
infile := fmt.Sprintf("%d.request", len(tc.Steps))
outfile := fmt.Sprintf("%d.response", len(tc.Steps))
checkErr(ioutil.WriteFile(infile, tryIndent(body), os.FileMode(0755)))
checkErr(ioutil.WriteFile(outfile, tryIndent(bodyOut), os.FileMode(0755)))
tc.Steps = append(tc.Steps, EditStep{
StepType: "request",
Input: infile,
Output: outfile,
RequestContentType: req.Header.Get("Content-Type"),
RequestMethod: req.Method,
RequestPath: req.URL.Path,
ResponseStatusCode: resp.StatusCode,
})
}
}
tcData, err := yaml.Marshal(tc)
checkErr(err)
checkErr(ioutil.WriteFile("test.yaml", tcData, os.FileMode(0755)))
})))
}
func checkErr(err error) {
if err != nil {
panic(err)
}
}
func tryIndent(data []byte) []byte {
indented := &bytes.Buffer{}
if err := json.Indent(indented, data, "", "\t"); err == nil {
return indented.Bytes()
}
return data
}

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
# send the original content to the server
curl -s -k -XPOST "http://localhost:8081/callback/in" --data-binary "@${1}"
# allow the user to edit the file
vi "${1}"
# send the resulting content to the server
curl -s -k -XPOST "http://localhost:8081/callback/out" --data-binary "@${1}"

View File

@@ -0,0 +1,70 @@
#!/usr/bin/env bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
if [[ -z "${1-}" ]]; then
echo "Usage: record_testcase.sh testcase-name"
exit 1
fi
# Clean up the test server
function cleanup {
if [[ ! -z "${pid-}" ]]; then
echo "Stopping recording server (${pid})"
# kill the process `go run` launched
pkill -P "${pid}"
# kill the `go run` process itself
kill -9 "${pid}"
fi
}
testcase="${1}"
test_root="$(dirname "${BASH_SOURCE}")"
testcase_dir="${test_root}/testcase-${testcase}"
mkdir -p "${testcase_dir}"
pushd "${testcase_dir}"
export EDITOR="../record_editor.sh"
go run "../record.go" &
pid=$!
trap cleanup EXIT
echo "Started recording server (${pid})"
# Make a kubeconfig that makes kubectl talk to our test server
edit_kubeconfig="${TMP:-/tmp}/edit_test.kubeconfig"
echo "apiVersion: v1
clusters:
- cluster:
server: http://localhost:8081
name: test
contexts:
- context:
cluster: test
user: test
name: test
current-context: test
kind: Config
users: []
" > "${edit_kubeconfig}"
export KUBECONFIG="${edit_kubeconfig}"
echo "Starting subshell. Type exit when finished."
bash
popd

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
# Send the file content to the server
if command -v curl &>/dev/null; then
curl -s -k -XPOST --data-binary "@${1}" -o "${1}.result" "${KUBE_EDITOR_CALLBACK}"
elif command -v wget &>/dev/null; then
wget --post-file="${1}" -O "${1}.result" "${KUBE_EDITOR_CALLBACK}"
else
echo "curl and wget are unavailable" >&2
exit 1
fi
# Use the response as the edited version
mv "${1}.result" "${1}"

View File

@@ -0,0 +1,21 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/configmaps/cm1",
"uid": "cc08a131-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3518",
"creationTimestamp": "2017-05-20T15:20:03Z",
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"baz\":\"qux\",\"foo\":\"changed-value\",\"new-data\":\"new-value\",\"new-data2\":\"new-value\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"name\":\"cm1\",\"namespace\":\"myproject\"}}\n"
}
},
"data": {
"baz": "qux",
"foo": "changed-value",
"new-data": "new-value",
"new-data2": "new-value"
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "d8b96f0b-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3525",
"creationTimestamp": "2017-05-20T15:20:24Z",
"labels": {
"app": "svc1",
"new-label": "foo"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 81
}
],
"clusterIP": "172.30.32.183",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,38 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
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:
annotations: {}
name: cm1
namespace: myproject
- kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
new-label2: foo2
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 82
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,36 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
apiVersion: v1
items:
- apiVersion: v1
data:
baz: qux
foo: changed-value
new-data: new-value
new-data2: new-value
kind: ConfigMap
metadata:
annotations: {}
name: cm1
namespace: myproject
- kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,41 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
# The edited file had a syntax error: error converting YAML to JSON: yaml: line 12: could not find expected ':'
#
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:
annotations: {}
name: cm1
namespace: myproject
- kind: Service
apiVersion: v1
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
new-label2: foo2
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 82
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,40 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
# The edited file had a syntax error: unable to get type info from the object "*unstructured.Unstructured": Object 'apiVersion' is missing in 'object has no apiVersion field'
#
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:
annotations: {}
name: cm1
namespace: myproject
- kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
new-label2: foo2
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 82
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,7 @@
{
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"baz\":\"qux\",\"foo\":\"changed-value\",\"new-data\":\"new-value\",\"new-data2\":\"new-value\",\"new-data3\":\"newivalue\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"name\":\"cm1\",\"namespace\":\"myproject\"}}\n"
}
}
}

View File

@@ -0,0 +1,21 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/configmaps/cm1",
"uid": "cc08a131-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3554",
"creationTimestamp": "2017-05-20T15:20:03Z",
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"baz\":\"qux\",\"foo\":\"changed-value\",\"new-data\":\"new-value\",\"new-data2\":\"new-value\",\"new-data3\":\"newivalue\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"name\":\"cm1\",\"namespace\":\"myproject\"}}\n"
}
},
"data": {
"baz": "qux",
"foo": "changed-value",
"new-data": "new-value",
"new-data2": "new-value"
}
}

View File

@@ -0,0 +1,7 @@
{
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\",\"new-label2\":\"foo2\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":82,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "d8b96f0b-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3555",
"creationTimestamp": "2017-05-20T15:20:24Z",
"labels": {
"app": "svc1",
"new-label": "foo"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\",\"new-label2\":\"foo2\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":82,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 81
}
],
"clusterIP": "172.30.32.183",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,43 @@
description: if the user omits an API version, edit will fail
mode: edit-last-applied
args:
- configmaps/cm1
- service/svc1
namespace: "myproject"
expectedStdout:
- configmap/cm1 edited
- service/svc1 edited
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/myproject/configmaps/cm1
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/myproject/services/svc1
expectedInput: 1.request
resultingStatusCode: 200
resultingOutput: 1.response
- type: edit
expectedInput: 2.original
resultingOutput: 2.edited
- type: edit
expectedInput: 3.original
resultingOutput: 3.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/myproject/configmaps/cm1
expectedContentType: application/merge-patch+json
expectedInput: 4.request
resultingStatusCode: 200
resultingOutput: 4.response
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/myproject/services/svc1
expectedContentType: application/merge-patch+json
expectedInput: 5.request
resultingStatusCode: 200
resultingOutput: 5.response

View File

@@ -0,0 +1,21 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/configmaps/cm1",
"uid": "cc08a131-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3518",
"creationTimestamp": "2017-05-20T15:20:03Z",
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"baz\":\"qux\",\"foo\":\"changed-value\",\"new-data\":\"new-value\",\"new-data2\":\"new-value\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"name\":\"cm1\",\"namespace\":\"myproject\"}}\n"
}
},
"data": {
"baz": "qux",
"foo": "changed-value",
"new-data": "new-value",
"new-data2": "new-value"
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "d8b96f0b-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3525",
"creationTimestamp": "2017-05-20T15:20:24Z",
"labels": {
"app": "svc1",
"new-label": "foo"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 81
}
],
"clusterIP": "172.30.32.183",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,39 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
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:
annotations: {}
name: cm1
namespace: myproject
- kind: Service
apiVersion: v1
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
new-label2: foo2
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 82
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,36 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
apiVersion: v1
items:
- apiVersion: v1
data:
baz: qux
foo: changed-value
new-data: new-value
new-data2: new-value
kind: ConfigMap
metadata:
annotations: {}
name: cm1
namespace: myproject
- kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
kind: List
metadata: {}

View File

@@ -0,0 +1,7 @@
{
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"baz\":\"qux\",\"foo\":\"changed-value\",\"new-data\":\"new-value\",\"new-data2\":\"new-value\",\"new-data3\":\"newivalue\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"name\":\"cm1\",\"namespace\":\"myproject\"}}\n"
}
}
}

View File

@@ -0,0 +1,21 @@
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "cm1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/configmaps/cm1",
"uid": "cc08a131-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3554",
"creationTimestamp": "2017-05-20T15:20:03Z",
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"baz\":\"qux\",\"foo\":\"changed-value\",\"new-data\":\"new-value\",\"new-data2\":\"new-value\",\"new-data3\":\"newivalue\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"name\":\"cm1\",\"namespace\":\"myproject\"}}\n"
}
},
"data": {
"baz": "qux",
"foo": "changed-value",
"new-data": "new-value",
"new-data2": "new-value"
}
}

View File

@@ -0,0 +1,7 @@
{
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\",\"new-label2\":\"foo2\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":82,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "d8b96f0b-3d6f-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3555",
"creationTimestamp": "2017-05-20T15:20:24Z",
"labels": {
"app": "svc1",
"new-label": "foo"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\",\"new-label2\":\"foo2\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":82,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 81
}
],
"clusterIP": "172.30.32.183",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,40 @@
description: add a testcase description
mode: edit-last-applied
args:
- configmaps/cm1
- service/svc1
namespace: "myproject"
expectedStdout:
- configmap/cm1 edited
- service/svc1 edited
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/myproject/configmaps/cm1
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/myproject/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/myproject/configmaps/cm1
expectedContentType: application/merge-patch+json
expectedInput: 3.request
resultingStatusCode: 200
resultingOutput: 3.response
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/myproject/services/svc1
expectedContentType: application/merge-patch+json
expectedInput: 4.request
resultingStatusCode: 200
resultingOutput: 4.response

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "1e16d988-3d72-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3731",
"creationTimestamp": "2017-05-20T15:36:39Z",
"labels": {
"app": "svc1",
"new-label": "foo"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 81
}
],
"clusterIP": "172.30.105.209",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,21 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
name: svc1
namespace: myproject
spec
ports:
name: "80"
port: 81
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {

View File

@@ -0,0 +1,21 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,24 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
# The edited file had a syntax error: error converting YAML to JSON: yaml: line 12: could not find expected ':'
#
kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
new-label1: foo1
name: svc1
namespace: myproject
spec:
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,23 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
# The edited file had a syntax error: error parsing edited-file: error converting YAML to JSON: yaml: line 12: could not find expected ':'
#
kind: Service
metadata:
annotations: {}
labels:
app: svc1
new-label: foo
name: svc1
namespace: myproject
spec
ports:
name: "80"
port: 81
protocol: TCP
targetPort: 81
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {

View File

@@ -0,0 +1,7 @@
{
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\",\"new-label1\":\"foo1\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
}
}

View File

@@ -0,0 +1,35 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "1e16d988-3d72-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3857",
"creationTimestamp": "2017-05-20T15:36:39Z",
"labels": {
"app": "svc1",
"new-label": "foo"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"svc1\",\"new-label\":\"foo\",\"new-label1\":\"foo1\"},\"name\":\"svc1\",\"namespace\":\"myproject\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":81}],\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 81
}
],
"clusterIP": "172.30.105.209",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,28 @@
description: edit with a syntax error, then re-edit and save
mode: edit-last-applied
args:
- service/svc1
namespace: myproject
expectedStdout:
- "service/svc1 edited"
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/myproject/services/svc1
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response
- type: edit
expectedInput: 1.original
resultingOutput: 1.edited
- type: edit
expectedInput: 2.original
resultingOutput: 2.edited
- type: request
expectedMethod: PATCH
expectedPath: /api/v1/namespaces/myproject/services/svc1
expectedContentType: application/merge-patch+json
expectedInput: 3.request
resultingStatusCode: 200
resultingOutput: 3.response

View File

@@ -0,0 +1,38 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "bc66b442-3d6a-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3036",
"creationTimestamp": "2017-05-20T14:43:49Z",
"labels": {
"app": "svc1",
"new-label": "new-value"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2017-02-01T21:14:09Z\",\"labels\":{\"app\":\"svc1\",\"new-label\":\"new-value\"},\"name\":\"svc1\",\"namespace\":\"myproject\",\"resourceVersion\":\"20820\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":80}],\"selector\":{\"app\":\"svc1\"},\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "172.30.136.24",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,26 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
apiVersion: v1
kind: Service
metadata:
annotations: {}
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: myproject
resourceVersion: "20820"
spec:
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 92
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,26 @@
# Please edit the 'last-applied-configuration' annotations below.
# Lines beginning with a '#' will be ignored, and an empty file will abort the edit.
#
apiVersion: v1
kind: Service
metadata:
annotations: {}
creationTimestamp: 2017-02-01T21:14:09Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: myproject
resourceVersion: "20820"
spec:
ports:
- name: "80"
port: 81
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,7 @@
{
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2017-02-01T21:14:09Z\",\"labels\":{\"app\":\"svc1\",\"new-label\":\"new-value\"},\"name\":\"svc1\",\"namespace\":\"myproject\",\"resourceVersion\":\"20820\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":92}],\"selector\":{\"app\":\"svc1\"},\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
}
}

View File

@@ -0,0 +1,38 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "svc1",
"namespace": "myproject",
"selfLink": "/api/v1/namespaces/myproject/services/svc1",
"uid": "bc66b442-3d6a-11e7-8ef0-c85b76034b7b",
"resourceVersion": "3093",
"creationTimestamp": "2017-05-20T14:43:49Z",
"labels": {
"app": "svc1",
"new-label": "new-value"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2017-02-01T21:14:09Z\",\"labels\":{\"app\":\"svc1\",\"new-label\":\"new-value\"},\"name\":\"svc1\",\"namespace\":\"myproject\",\"resourceVersion\":\"20820\"},\"spec\":{\"ports\":[{\"name\":\"80\",\"port\":81,\"protocol\":\"TCP\",\"targetPort\":92}],\"selector\":{\"app\":\"svc1\"},\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 81,
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"clusterIP": "172.30.136.24",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,27 @@
description: add a testcase description
mode: edit-last-applied
args:
- service
- svc1
outputFormat: yaml
namespace: myproject
expectedStdout:
- service/svc1 edited
expectedExitCode: 0
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/myproject/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/myproject/services/svc1
expectedContentType: application/merge-patch+json
expectedInput: 2.request
resultingStatusCode: 200
resultingOutput: 2.response

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,34 @@
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"creationTimestamp": "2017-02-03T06:44:47Z",
"labels": {
"app": "svc1modified"
},
"name": "svc1",
"namespace": "edit-test",
"resourceVersion": "",
"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,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,34 @@
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"creationTimestamp": "2017-02-03T06:44:43Z",
"labels": {
"app": "svc2modified"
},
"name": "svc2",
"namespace": "edit-test",
"resourceVersion": "",
"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,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,27 @@
{
"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,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,27 @@
{
"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,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,21 @@
{
"spec": {
"$setElementOrder/ports": [
{
"port": 82
}
],
"ports": [
{
"name": "80",
"port": 82,
"protocol": "TCP",
"targetPort": 80
},
{
"$patch": "delete",
"port": 81
}
]
}
}

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,9 @@
{
"kind": "ConfigMapList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces/edit-test/configmaps",
"resourceVersion": "252"
},
"items": []
}

View File

@@ -0,0 +1,15 @@
description: add a testcase description
mode: edit
args:
- configmap
namespace: "edit-test"
expectedStderr:
- edit cancelled, no objects found.
expectedExitCode: 1
steps:
- type: request
expectedMethod: GET
expectedPath: /api/v1/namespaces/edit-test/configmaps
expectedInput: 0.request
resultingStatusCode: 200
resultingOutput: 0.response

View File

@@ -0,0 +1,38 @@
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"kind\":\"Service\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"svc1\",\"creationTimestamp\":null,\"labels\":{\"app\":\"svc1\"}},\"spec\":{\"ports\":[{\"name\":\"80\",\"protocol\":\"TCP\",\"port\":80,\"targetPort\":80}],\"selector\":{\"app\":\"svc1\"},\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
},
"creationTimestamp": "2017-02-27T19:40:53Z",
"labels": {
"app": "svc1"
},
"name": "svc1",
"namespace": "edit-test",
"resourceVersion": "670",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "a6c11186-fd24-11e6-b53c-480fcf4a5275"
},
"spec": {
"clusterIP": "10.0.0.204",
"ports": [
{
"name": "80",
"port": 80,
"protocol": "TCP",
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"sessionAffinity": "None",
"type": "ClusterIP"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,32 @@
# 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:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
labels:
app: svc1
new-label: new-value
name: svc1
namespace: edit-test
resourceVersion: "670"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: a6c11186-fd24-11e6-b53c-480fcf4a5275
spec:
clusterIP: 10.0.0.204
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,31 @@
# 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:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"kind":"Service","apiVersion":"v1","metadata":{"name":"svc1","creationTimestamp":null,"labels":{"app":"svc1"}},"spec":{"ports":[{"name":"80","protocol":"TCP","port":80,"targetPort":80}],"selector":{"app":"svc1"},"type":"ClusterIP"},"status":{"loadBalancer":{}}}
creationTimestamp: 2017-02-27T19:40:53Z
labels:
app: svc1
name: svc1
namespace: edit-test
resourceVersion: "670"
selfLink: /api/v1/namespaces/edit-test/services/svc1
uid: a6c11186-fd24-11e6-b53c-480fcf4a5275
spec:
clusterIP: 10.0.0.204
ports:
- name: "80"
port: 80
protocol: TCP
targetPort: 80
selector:
app: svc1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

View File

@@ -0,0 +1,10 @@
{
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2017-02-27T19:40:53Z\",\"labels\":{\"app\":\"svc1\",\"new-label\":\"new-value\"},\"name\":\"svc1\",\"namespace\":\"edit-test\",\"resourceVersion\":\"670\",\"selfLink\":\"/api/v1/namespaces/edit-test/services/svc1\",\"uid\":\"a6c11186-fd24-11e6-b53c-480fcf4a5275\"},\"spec\":{\"clusterIP\":\"10.0.0.204\",\"ports\":[{\"name\":\"80\",\"port\":80,\"protocol\":\"TCP\",\"targetPort\":80}],\"selector\":{\"app\":\"svc1\"},\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
},
"labels": {
"new-label": "new-value"
}
}
}

View File

@@ -0,0 +1,38 @@
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2017-02-27T19:40:53Z\",\"labels\":{\"app\":\"svc1\",\"new-label\":\"new-value\"},\"name\":\"svc1\",\"namespace\":\"edit-test\",\"resourceVersion\":\"670\",\"selfLink\":\"/api/v1/namespaces/edit-test/services/svc1\",\"uid\":\"a6c11186-fd24-11e6-b53c-480fcf4a5275\"},\"spec\":{\"clusterIP\":\"10.0.0.204\",\"ports\":[{\"name\":\"80\",\"port\":80,\"protocol\":\"TCP\",\"targetPort\":80}],\"selector\":{\"app\":\"svc1\"},\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"
},
"name": "svc1",
"namespace": "edit-test",
"selfLink": "/api/v1/namespaces/edit-test/services/svc1",
"uid": "a6c11186-fd24-11e6-b53c-480fcf4a5275",
"resourceVersion":"1045",
"creationTimestamp":"2017-02-27T19:40:53Z",
"labels": {
"app": "svc1",
"new-label": "new-value"
}
},
"spec": {
"clusterIP": "10.0.0.204",
"ports": [
{
"name": "80",
"port": 80,
"protocol": "TCP",
"targetPort": 80
}
],
"selector": {
"app": "svc1"
},
"sessionAffinity": "None",
"type": "ClusterIP"
},
"status": {
"loadBalancer": {}
}
}

View File

@@ -0,0 +1,32 @@
# kubectl create namespace edit-test
# kubectl create service clusterip svc1 --tcp 80 --namespace=edit-test --save-config
# kubectl edit service svc1 --namespace=edit-test --save-config=true --output-patch=true
description: edit with flag --output-patch=true should output the patch
mode: edit
args:
- service
- svc1
saveConfig: "true"
outputPatch: "true"
namespace: edit-test
expectedStdout:
- 'Patch: {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"creationTimestamp\":\"2017-02-27T19:40:53Z\",\"labels\":{\"app\":\"svc1\",\"new-label\":\"new-value\"},\"name\":\"svc1\",\"namespace\":\"edit-test\",\"resourceVersion\":\"670\",\"selfLink\":\"/api/v1/namespaces/edit-test/services/svc1\",\"uid\":\"a6c11186-fd24-11e6-b53c-480fcf4a5275\"},\"spec\":{\"clusterIP\":\"10.0.0.204\",\"ports\":[{\"name\":\"80\",\"port\":80,\"protocol\":\"TCP\",\"targetPort\":80}],\"selector\":{\"app\":\"svc1\"},\"sessionAffinity\":\"None\",\"type\":\"ClusterIP\"},\"status\":{\"loadBalancer\":{}}}\n"},"labels":{"new-label":"new-value"}}}'
- 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

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

@@ -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

@@ -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: {}

Some files were not shown because too many files have changed in this diff Show More