github.com/replicatedcom/ship@v0.50.0/integration/base/README.md (about) 1 # Console integration tests 2 3 These are tests for ship yaml, with the intention of testing functionality used with console/pg.replicated.com 4 5 ## Running the integration tests (from the parent directory) 6 7 ### Quick Start 8 ```shell 9 make integration-test 10 ``` 11 12 ### Dependencies 13 - Helm 14 - Terraform 15 - Test Docker Registry 16 * To run a local Docker registry for tests, run the following command: 17 ```sh 18 docker run -d -p 5000:5000 --restart=always --name registry registry:2 19 ``` 20 - Test S3 Bucket 21 * To run a local http server for tests, run the following command: 22 ```sh 23 npm install -g http-echo-server 24 PORT=4569 http-echo-server 25 ``` 26 27 ## Running the integration tests (from a docker image) 28 29 The integration test docker image can be built with 30 31 ```shell 32 make build_ship_integration_test 33 ``` 34 35 The resulting image can be run with 36 37 ```shell 38 docker run --net="host" -it -v /var/run/docker.sock:/var/run/docker.sock replicated/ship-e2e-test:latest 39 ``` 40 41 ## Adding a new integration test 42 43 Each integration test is a folder containing a yaml file with the 44 desired customer ID/installation ID/release semver, a folder 'input' containing 45 `.ship/release.yml` and `.ship/state.json`, and a folder 'expected' 46 containing the expected output of running ship with that state file, release yaml, 47 and customer ID/installation ID/release semver. 48 49 Each integration test is run twice - once in runbook (or 'local yaml') mode and once in online mode. 50 Both runs are headless and use the Cobra API to simulate running Ship from the CLI. 51 The runbook mode run will use the release yaml located at `input/.ship/release.yml` and the state file located at `input/.ship/state.json`. 52 The online mode run will use the state file at `input/.ship/state.json` but will get the release yaml from the graphql api using the provided customer ID, installation ID and release semver. 53 Files are produced in a temporary directory created within the integration test directory. 54 The contents of this directory is then diffed with the contents of `expected/`. 55 File names and contents must match. 56 57 To add a new test, create a release that should demonstrate the desired behavior in the integration test staging account. 58 You should also create a new directory for your test within the integration subdirectory. 59 After running this release in an empty directory, copy the files produced (including hidden directories) to `<your_test_dir>/expected` and the `.ship` directory to `<your_test_dir>/input/.ship`. 60 The contents of the `.ship` directory within expected and input can differ if desired. 61 Finally, add a file `<your_test_dir>/metadata.yaml` and include strings for `customer_id`, `installation_id` and `release_version`.