...

Text file src/k8s.io/kubectl/pkg/cmd/edit/testdata/README

Documentation: k8s.io/kubectl/pkg/cmd/edit/testdata

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

View as plain text