Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 51 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

19 changes: 19 additions & 0 deletions tests/attributes.bats
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
30 changes: 30 additions & 0 deletions tests/encrypt-decrypt.bats
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
15 changes: 15 additions & 0 deletions tests/kas-registry.bats
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
19 changes: 19 additions & 0 deletions tests/namespace.bats
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
15 changes: 15 additions & 0 deletions tests/resource-mapping.bats
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
15 changes: 15 additions & 0 deletions tests/subject-condition-sets.bats
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
15 changes: 15 additions & 0 deletions tests/subject-mapping.bats
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