README 1.4 KB

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