From 023ce6f0b8fa5758af30e7e2bd7b8afd8601c57f Mon Sep 17 00:00:00 2001 From: Timon Borter Date: Thu, 4 Jul 2024 16:35:14 +0200 Subject: [PATCH] ci: switch to rust integration tests --- .github/workflows/build.yml | 47 +---- ...Test_propeller.xml => Build_propeller.xml} | 4 +- .../Integration_Test_propeller.xml | 19 ++ .../runConfigurations/Unit_Test_propeller.xml | 19 ++ ...__rotate.xml => propeller__init_vault.xml} | 4 +- ...__init_vault.xml => propeller__rotate.xml} | 4 +- Cargo.toml | 6 + DEVELOPMENT.md | 9 +- package-lock.json | 196 +----------------- package.json | 4 +- src/config.rs | 26 +++ src/password.rs | 6 +- src/vault.rs | 8 +- src/workflow.rs | 70 +++---- tests/init_vault.rs | 76 +++++++ tests/resources/config/missing_postgresql.yml | 3 + tests/resources/config/missing_vault.yml | 2 + tests/resources/init_vault/invalid_url.yml | 5 + tests/resources/init_vault/new_path.yml | 5 + 19 files changed, 226 insertions(+), 287 deletions(-) rename .idea/runConfigurations/{Test_propeller.xml => Build_propeller.xml} (79%) create mode 100644 .idea/runConfigurations/Integration_Test_propeller.xml create mode 100644 .idea/runConfigurations/Unit_Test_propeller.xml rename .idea/runConfigurations/{Run_propeller__rotate.xml => propeller__init_vault.xml} (88%) rename .idea/runConfigurations/{Run_propeller__init_vault.xml => propeller__rotate.xml} (82%) create mode 100644 tests/init_vault.rs create mode 100644 tests/resources/config/missing_postgresql.yml create mode 100644 tests/resources/config/missing_vault.yml create mode 100644 tests/resources/init_vault/invalid_url.yml create mode 100644 tests/resources/init_vault/new_path.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0772da..e511520 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} @@ -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 @@ -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 diff --git a/.idea/runConfigurations/Test_propeller.xml b/.idea/runConfigurations/Build_propeller.xml similarity index 79% rename from .idea/runConfigurations/Test_propeller.xml rename to .idea/runConfigurations/Build_propeller.xml index 6603343..ded5306 100644 --- a/.idea/runConfigurations/Test_propeller.xml +++ b/.idea/runConfigurations/Build_propeller.xml @@ -1,6 +1,6 @@ - -