Skip to content

Commit

Permalink
ci: switch to rust integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bbortt committed Jul 4, 2024
1 parent 51e17f2 commit 023ce6f
Show file tree
Hide file tree
Showing 19 changed files with 226 additions and 287 deletions.
47 changes: 11 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,18 @@ jobs:
build:
name: 'Rust Build'
runs-on: ubuntu-latest
services:
vault:
image: hashicorp/vault:1.17.1
ports:
- 8200:8200
options: --cap-add=IPC_LOCK
env:
VAULT_DEV_ROOT_TOKEN_ID: 'root-token'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install stable toolchain
- name: Install stable Toolchain
uses: actions-rs/toolchain@v1
with:
profile: ${{ env.TOOLCHAIN_PROFILE }}
Expand All @@ -40,10 +48,11 @@ jobs:
with:
command: clippy
# args: -- -D warnings
- name: Unit- and Integration-Tests
- name: Unit and Integration Tests
uses: actions-rs/cargo@v1
env:
RUST_TEST_THREADS: 1
VAULT_TOKEN: 'root-token'
with:
command: test
- name: Build Binary
Expand All @@ -56,40 +65,6 @@ jobs:
with:
name: cli
path: target/release/propeller
test:
name: 'Integration Test CLI'
needs: build
runs-on: ubuntu-latest
services:
vault:
image: hashicorp/vault:1.17.1
ports:
- 8200:8200
options: --cap-add=IPC_LOCK
env:
VAULT_DEV_ROOT_TOKEN_ID: 'root-token'
steps:
- name: Check out code
uses: actions/checkout@v4
with:
name: cli
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.15.0
cache: 'npm'
- name: Install node.js packages
run: npm ci
- name: Wait for Vault
run: npm run ci:wait-for-vault
- name: Download Binary
uses: actions/download-artifact@v4
- name: Run integration tests
run: |
chmod 755 ./cli/propeller
./cli/propeller init-vault -c dev/config.yml
env:
VAULT_TOKEN: 'root-token'
check:
name: 'Resources Validation'
runs-on: ubuntu-latest
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/runConfigurations/Integration_Test_propeller.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/runConfigurations/Unit_Test_propeller.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ serde_yaml = "0.9.34+deprecated"
tokio = { version = "1.38.0", features = ["macros", "rt"] }
vaultrs = "0.7.2"
rand = "0.9.0-alpha.1"

[dev-dependencies]
assert_cmd = "2.0.14"
predicates = "3.1.0"
reqwest = { version = "0.12.5", features = ["json"] }
serde_json = "1.0.120"
9 changes: 6 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ Before you start, ensure you have the following installed:

- [Git](https://git-scm.com/downloads): For version control
- Git LFS: For managing large files within the project
- [Node.js](https://nodejs.org/en/download: For running certain project scripts (including dependency management)
- [Node.js](https://nodejs.org/en/download): For running certain project scripts (including dependency management)
- [`podman`](https://podman.io/docs/installation) or [Docker](https://www.docker.com/products/docker-desktop/): For containerization of the Vault instance and databases
- This is especially required for [integration testing](#running-tests)

## Cloning the Repository
## Preparing the Repository

1. Clone the `propeller` project from GitHub:

Expand Down Expand Up @@ -52,7 +53,7 @@ npm ci --cache .npm
- **A Vault instance:** For managing secrets

Note that if using any of the below options, Vault will be accessible on http://localhost:8200.
Extract the root token from the logs of the container.
The root token for development is 'root-token'.

### Setting up with `podman`:

Expand Down Expand Up @@ -93,6 +94,8 @@ Cargo makes it easy to run the project's unit and integration tests:
cargo tests
```

**Note that the integration tests need active Vault and PostgreSQL connections, as described [here](#environment-setup).**

Cargo will automatically discover and execute the tests defined within the project.

### Running the CLI
Expand Down
Loading

0 comments on commit 023ce6f

Please sign in to comment.