k8s.io/kubernetes@v1.29.3/test/cmd/README.md (about)

     1  # Kubernetes Command-Line Integration Test Suite
     2  
     3  This document describes how you can use the Kubernetes command-line integration test-suite.
     4  
     5  ## Running Tests
     6  
     7  ### All Tests
     8  
     9  To run this entire suite, execute `make test-cmd` from the top level.  This will import each file containing tests functions
    10  
    11  ### Specific Tests
    12  
    13  To run a subset of tests (e.g. `run_deployment_tests` and `run_impersonation_tests`), execute `make test-cmd WHAT="deployment impersonation"`.  Running specific
    14  tests will not try and validate any required resources are available on the server.
    15  
    16  ## Adding Tests
    17  
    18  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
    19  
    20  ```bash
    21  ######################
    22  # Replica Sets       #
    23  ######################
    24  
    25  if kube::test::if_supports_resource "${replicasets}" ; then
    26      record_command run_rs_tests
    27  fi
    28  ```
    29  
    30  Be sure to validate any supported resources required for the test by using the `kube::test::if_supports_resource` function. 
    31  
    32  
    33  ### New File
    34  
    35  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
    36  ```bash
    37  source "${KUBE_ROOT}/test/cmd/apply.sh"
    38  source "${KUBE_ROOT}/test/cmd/apps.sh"
    39  source "${KUBE_ROOT}/test/cmd/authorization.sh"
    40  source "${KUBE_ROOT}/test/cmd/batch.sh"
    41  ...
    42  ```
    43  
    44  Please keep the order of the source list alphabetical.