-
Notifications
You must be signed in to change notification settings - Fork 6
feat(ci): Add e2e workflow setup + bats #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e045465
add e2e workflow to ci
elizabethhealy 7ce8016
setup bats structure
elizabethhealy 9de37bd
chmod
elizabethhealy 197cfe4
dont have to check status
elizabethhealy 47e6043
move host to variable
elizabethhealy ac8edc6
workflow yaml cleanup
elizabethhealy cc1f5ee
add teardown with file cleanup
elizabethhealy e195aa3
add to readme
elizabethhealy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -37,9 +37,55 @@ jobs: | |
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
| - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | ||
| - name: Check out platform | ||
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
| cache: false | ||
| - name: e2e Tests | ||
| run: echo "No e2e tests yet." && exit 0 | ||
| repository: opentdf/platform | ||
| path: platform | ||
| - name: Set up go | ||
| uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 | ||
| with: | ||
| go-version-file: 'platform/service/go.mod' | ||
| check-latest: false | ||
| cache-dependency-path: | | ||
| platform/service/go.sum | ||
| platform/examples/go.sum | ||
| platform/protocol/go/go.sum | ||
| platform/sdk/go.sum | ||
| - run: | | ||
| .github/scripts/init-temp-keys.sh | ||
| cp opentdf-dev.yaml opentdf.yaml | ||
| working-directory: platform | ||
| - name: Added Trusted Certs | ||
| run: | | ||
| sudo chmod -R 777 ./keys | ||
| sudo apt-get install -y ca-certificates | ||
| sudo cp ./keys/localhost.crt /usr/local/share/ca-certificates | ||
| sudo update-ca-certificates | ||
| working-directory: platform | ||
| - run: docker compose up -d --wait --wait-timeout 240 | ||
| working-directory: platform | ||
| - run: go run ./service provision keycloak | ||
| working-directory: platform | ||
| - run: go run ./service provision fixtures | ||
| working-directory: platform | ||
| - uses: JarvusInnovations/background-action@2428e7b970a846423095c79d43f759abf979a635 | ||
| name: start server in background | ||
| with: | ||
| run: > | ||
| go build -o opentdf -v service/main.go | ||
| && .github/scripts/watch.sh opentdf.yaml ./opentdf start | ||
| wait-on: | | ||
| tcp:localhost:8080 | ||
| log-output-if: true | ||
| wait-for: 90s | ||
| working-directory: platform | ||
|
|
||
| - name: build the CLI | ||
| run: go build . | ||
| - name: set up the config | ||
| run: cp otdfctl-example.yaml otdfctl.yaml | ||
| - name: Setup Bats and bats libs | ||
| uses: bats-core/[email protected] | ||
| - run: tests/encrypt-decrypt.bats | ||
|
|
||
This file contains hidden or 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,19 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| # Tests for attributes | ||
|
|
||
| # Create attribute | ||
|
|
||
| # Get Attribute | ||
|
|
||
| # Update attribute | ||
|
|
||
| # List attributes | ||
|
|
||
| # Deactivate Attribute | ||
|
|
||
| # Unsafe Reactivate | ||
|
|
||
| # Unsafe Delete | ||
|
|
||
| # Cleanup -- delete everything created here |
This file contains hidden or 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,30 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| # Tests for encrypt decrypt | ||
|
|
||
| setup() { | ||
| echo -n '{"clientId":"opentdf","clientSecret":"secret"}' > creds.json | ||
| export WITH_CREDS='--with-client-creds-file ./creds.json' | ||
| export HOST=http://localhost:8080/kas | ||
| } | ||
|
|
||
| teardown() { | ||
| rm -f result.yaml sensitive.yaml.tdf | ||
| } | ||
|
|
||
| @test "roundtrip TDF3" { | ||
| ./otdfctl encrypt -o sensitive.yaml.tdf --host $HOST --tls-no-verify --log-level debug $WITH_CREDS --tdf-type tdf3 otdfctl.yaml | ||
| ./otdfctl decrypt -o result.yaml --host $HOST --tls-no-verify --log-level debug $WITH_CREDS --tdf-type tdf3 sensitive.yaml.tdf | ||
| diff otdfctl.yaml result.yaml | ||
| } | ||
|
|
||
| @test "roundtrip NANO" { | ||
| ./otdfctl encrypt -o sensitive.yaml.tdf --host $HOST --tls-no-verify --log-level debug $WITH_CREDS --tdf-type nano otdfctl.yaml | ||
| ./otdfctl decrypt -o result.yaml --host $HOST --tls-no-verify --log-level debug $WITH_CREDS --tdf-type nano sensitive.yaml.tdf | ||
| diff otdfctl.yaml result.yaml | ||
| } | ||
|
|
||
| # Future Tests | ||
|
|
||
| # Encrypt and decrypt with attributes: | ||
| # Create an attribute and a subject mapping for the specific clientId then roundtrip trip w it |
This file contains hidden or 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,15 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| # Tests for kas registry | ||
|
|
||
| # Create kas registration | ||
|
|
||
| # Get kas registration | ||
|
|
||
| # Update kas registration | ||
|
|
||
| # List kas registrations | ||
|
|
||
| # Delete kas registration | ||
|
|
||
| # Cleanup - delete everything |
This file contains hidden or 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,19 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| # Tests for namespaces | ||
|
|
||
| # Create namespace | ||
|
|
||
| # Get namesapce | ||
|
|
||
| # Update namespace | ||
|
|
||
| # List namespaces | ||
|
|
||
| # Deactivate namespace | ||
|
|
||
| # Unsafe namespace | ||
|
|
||
| # Unsafe namespace | ||
|
|
||
| # Cleanup - delete everything |
This file contains hidden or 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,15 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| # Tests for resource mappings | ||
|
|
||
| # Create resource mapping | ||
|
|
||
| # Get resource mapping | ||
|
|
||
| # Update resource mapping | ||
|
|
||
| # List resource mappings | ||
|
|
||
| # Delete resource mapping | ||
|
|
||
| # Cleanup - delete everything |
This file contains hidden or 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,15 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| # Tests for subject condition sets | ||
|
|
||
| # Create scs | ||
|
|
||
| # Get scs | ||
|
|
||
| # Update scs | ||
|
|
||
| # List scs | ||
|
|
||
| # Delete scs | ||
|
|
||
| # Cleanup - delete everything |
This file contains hidden or 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,15 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| # Tests for subject mappings | ||
|
|
||
| # Create sm | ||
|
|
||
| # Get sm | ||
|
|
||
| # Update sm | ||
|
|
||
| # List sm | ||
|
|
||
| # Delete sm | ||
|
|
||
| # Cleanup - delete everything |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.