github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/e2e/README.md (about) 1 # End-to-end testing of kpt 2 3 ## kpt live e2e tests 4 5 We currently have two different solutions for running e2e tests for the kpt 6 live functionality. We are working on reconciling this into one approach that 7 we can use consistently. 8 9 All e2e tests for live requires that kind is available. 10 11 ### Testing with go 12 13 We have a framework for running e2e tests based on specifying test cases 14 under testdata/live-apply folder (tests for other kpt live commands will be 15 added). The entry point for the test framework is in 16 the `live_test.go` file. 17 18 In order to run all the tests for live apply, there is a make target 19 ```sh 20 make test-live-apply 21 ``` 22 23 It is possible to run a single test by specifying the name of the test case: 24 ```sh 25 make test-live-apply T=crd-and-cr 26 ``` 27 28 #### Structure of a test case 29 30 Each test case is a folder directly under `testdata/live-apply`. In the root 31 of each test case folder there must be a `config.yaml` file that provides the 32 configuration of the test case (like whether a clean cluster is required and 33 the expected output). The package that will be applied with `kpt live apply` is 34 provided in the `resources` folder. 35 36 #### Configuration options 37 38 These are the configuration options available in the `config.yaml` file: 39 * `exitCode`: Defines the expected exit code after running the kpt live command. Defaults to 0. 40 * `stdErr`: Defines the expected output to stdErr after running the command. Defaults to "". 41 * `stdOut`: Defines the expected output to stdOut after running the command. Defaults to "". 42 * `inventory`: Defines the expected inventory after running the command. 43 * `requiresCleanCluster`: Defines whether a new kind cluster should be created prior to running the test. 44 * `preinstallResourceGroup`: Defines whether the framework should make sure the RG CRD is available before running the test. 45 * `kptArgs`: Defines the arguments that will be used with executing the kpt live command. 46 47 ## Testing with bash 48 49 This approach uses a bash script that runs through several scenarios for 50 kpt live in sequence. Run it by running 51 ```sh 52 ./live/end-to-end-test.sh 53 ```