iwita 21196b4a6d added v1.15.4 5 years ago
..
testcase-apply-edit-last-applied 21196b4a6d added v1.15.4 5 years ago
testcase-apply-edit-last-applied-list 21196b4a6d added v1.15.4 5 years ago
testcase-apply-edit-last-applied-list-fail 21196b4a6d added v1.15.4 5 years ago
testcase-apply-edit-last-applied-syntax-error 21196b4a6d added v1.15.4 5 years ago
testcase-create-list 21196b4a6d added v1.15.4 5 years ago
testcase-create-list-error 21196b4a6d added v1.15.4 5 years ago
testcase-edit-error-reedit 21196b4a6d added v1.15.4 5 years ago
testcase-edit-from-empty 21196b4a6d added v1.15.4 5 years ago
testcase-edit-output-patch 21196b4a6d added v1.15.4 5 years ago
testcase-immutable-name 21196b4a6d added v1.15.4 5 years ago
testcase-list 21196b4a6d added v1.15.4 5 years ago
testcase-list-errors 21196b4a6d added v1.15.4 5 years ago
testcase-list-record 21196b4a6d added v1.15.4 5 years ago
testcase-missing-service 21196b4a6d added v1.15.4 5 years ago
testcase-no-op 21196b4a6d added v1.15.4 5 years ago
testcase-not-update-annotation 21196b4a6d added v1.15.4 5 years ago
testcase-repeat-error 21196b4a6d added v1.15.4 5 years ago
testcase-schemaless-list 21196b4a6d added v1.15.4 5 years ago
testcase-single-service 21196b4a6d added v1.15.4 5 years ago
testcase-syntax-error 21196b4a6d added v1.15.4 5 years ago
testcase-unknown-field-known-group-kind 21196b4a6d added v1.15.4 5 years ago
testcase-unknown-version-known-group-kind 21196b4a6d added v1.15.4 5 years ago
testcase-update-annotation 21196b4a6d added v1.15.4 5 years ago
BUILD 21196b4a6d added v1.15.4 5 years ago
README 21196b4a6d added v1.15.4 5 years ago
record.go 21196b4a6d added v1.15.4 5 years ago
record_editor.sh 21196b4a6d added v1.15.4 5 years ago
record_testcase.sh 21196b4a6d added v1.15.4 5 years ago
test_editor.sh 21196b4a6d added v1.15.4 5 years ago

README

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