kubernetes/test/cmd
Patrick Ohly a85f489b28 client-go/transport: structured, contextual logging
The revised logging emits one log entry at the start of
round-tripping ("Request") and another at the end ("Response"). This avoids the
risk that related output gets interleaved by other output.

No API changes are necessary. A contextual logger is picked up from the context
of the request that is being handled. The verbosity level of that logger is
checked to determine what is supposed to be logged. This enables reducing log
details on a by-request basis by storing a `logger.V(1)` in the context of the
request.

As before, logging only gets injected into request processing at -v6 or higher,
so normally there is no additional overhead.
2025-01-27 09:45:04 +01:00
..
apply.sh add --subresource to kubectl apply 2024-10-02 13:28:29 -04:00
apps.sh Update shellcheck version (0.7.2 -> 0.8.0) and fix findings 2022-11-08 11:53:57 +01:00
auth_whoami.sh Fix cmd, integration, and conformance tests 2023-05-03 01:29:37 +02:00
authentication.sh
authorization.sh
batch.sh Update shellcheck version (0.7.2 -> 0.8.0) and fix findings 2022-11-08 11:53:57 +01:00
certificate.sh
convert.sh
core.sh switch k/k to pause version 3.10 2024-05-24 10:02:51 +03:00
crd.sh remove PruneWhitelist, use prune-allowlist instead 2023-12-15 11:51:14 +08:00
create.sh Merge pull request #109850 from ardaguclu/validate-nooptdefval 2022-06-13 08:04:11 -07:00
debug.sh Add integration tests for custom profiling in kubectl debug 2024-06-05 10:18:20 +03:00
delete.sh KEP-3895: Promote interactive delete to beta 2023-09-05 11:16:30 +03:00
diff.sh switch k/k to pause version 3.10 2024-05-24 10:02:51 +03:00
discovery.sh Fix kubectl explain bug when additionalProperties in schema defines as boolean. (#124506) 2024-05-21 04:40:32 -07:00
events.sh fix(test): delete cronjobs.v1.example.com pi for clean up 2023-09-01 23:13:26 +08:00
exec.sh Remove deprecated kubectl exec command execution without dash (#125437) 2024-06-21 09:22:55 -07:00
generic-resources.sh tests: adding integration test for rollout status 2022-04-21 11:21:13 -04:00
get.sh client-go/transport: structured, contextual logging 2025-01-27 09:45:04 +01:00
help.sh Optimize usage message of commands which have subcommands. 2023-05-26 10:07:43 +08:00
kubeconfig.sh Clarify, document KUBE_OUTPUT_* variables 2024-02-29 22:05:42 -08:00
legacy-script.sh Revert "Add new --wait-for-creation flag in kubectl wait command" 2024-06-21 12:13:08 -04:00
node-management.sh client-go/transport: structured, contextual logging 2025-01-27 09:45:04 +01:00
OWNERS
plugins.sh KEP-3638: Promote plugin resolution to beta (#120663) 2023-10-23 13:41:38 +02:00
proxy.sh
rbac.sh add a warning printer in cli-runtime to coordinate warning style 2022-05-23 19:10:15 +08:00
README.md
request-timeout.sh flake(kubectl): fix run_kubectl_request_timeout_tests in integration test 2024-10-16 20:44:25 +08:00
results.sh
run.sh
save-config.sh
storage.sh add a warning printer in cli-runtime to coordinate warning style 2022-05-23 19:10:15 +08:00
template-output.sh fix typos in pkg/validation and test/cmd 2022-09-20 19:12:17 +05:30
version.sh Update version.sh 2023-11-04 17:22:30 +08:00
wait.sh kubectl: fix wait --for=create to work correctly with label selectors (#128662) 2024-12-12 02:57:28 +00:00

Kubernetes Command-Line Integration Test Suite

This document describes how you can use the Kubernetes command-line integration test-suite.

Running Tests

All Tests

To run this entire suite, execute make test-cmd from the top level. This will import each file containing tests functions

Specific Tests

To run a subset of tests (e.g. run_deployment_tests and run_impersonation_tests), execute make test-cmd WHAT="deployment impersonation". Running specific tests will not try and validate any required resources are available on the server.

Adding Tests

Test functions need to have the format run_*_tests so they can be executed individually. Once a test has been added, insert a section in legacy-script.sh like

######################
# Replica Sets       #
######################

if kube::test::if_supports_resource "${replicasets}" ; then
    record_command run_rs_tests
fi

Be sure to validate any supported resources required for the test by using the kube::test::if_supports_resource function.

New File

If the test resides in a new file, source the file in the top of the legacy-script.sh file by adding a new line in

source "${KUBE_ROOT}/test/cmd/apply.sh"
source "${KUBE_ROOT}/test/cmd/apps.sh"
source "${KUBE_ROOT}/test/cmd/authorization.sh"
source "${KUBE_ROOT}/test/cmd/batch.sh"
...

Please keep the order of the source list alphabetical.