-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add e2e test with docker compose
Includes a negative test to make sure that policy validation does something. Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: KBS End-to-End test with Docker Compose and Sample Attester | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
TEST_SECRET_CONTENT: shhhhh | ||
TEST_SECRET_PATH: test-org/test-repo/test-secret | ||
TEST_SECRET_FILENAME: test-secret | ||
|
||
jobs: | ||
e2e-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout KBS | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust (for client) | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
|
||
- name: Install TPM dependencies (for client) | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y libtss2-dev | ||
- name: Build client | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --manifest-path kbs/tools/client/Cargo.toml | ||
|
||
- name: Setup Keys | ||
run: | | ||
openssl genpkey -algorithm ed25519 > kbs/config/private.key | ||
openssl pkey -in kbs/config/private.key -pubout -out kbs/config/public.pub | ||
- name: Build KBS Cluster | ||
run: docker compose build | ||
|
||
- name: Start KBS cluster | ||
run: docker compose up -d | ||
|
||
- name: Create Test Resource | ||
working-directory: target/debug/ | ||
run: echo "$TEST_SECRET_CONTENT" > "$TEST_SECRET_FILENAME" | ||
|
||
- name: Set Resource | ||
working-directory: target/debug/ | ||
run: ./kbs-client --url http://127.0.0.1:8080 config --auth-private-key ../../kbs/config/private.key set-resource --path $TEST_SECRET_PATH --resource-file $TEST_SECRET_FILENAME | ||
|
||
- name: Get Resource (negative) | ||
working-directory: target/debug/ | ||
run: ./kbs-client --url http://127.0.0.1:8080 get-resource --path $TEST_SECRET_PATH | ||
if: ${{ failure() }} | ||
|
||
- name: Update policy | ||
run: ./kbs-client --url http://127.0.0.1:8080 config --auth-private-key ../../kbs/config/private.key set-resource-policy --policy-file $policy_path | ||
env: | ||
policy_path: ../../kbs/test/data/policy_2.rego | ||
|
||
- name: Get Resource | ||
working-directory: target/debug/ | ||
run: ./kbs-client --url http://127.0.0.1:8080 get-resource --path $TEST_SECRET_PATH |