Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
BDD test cleanup - EDV
Browse files Browse the repository at this point in the history
Signed-off-by: Yevgen Pukhta <eugene.pukhta@gmail.com>

Signed-off-by: Yevgen Pukhta <eugene.pukhta@gmail.com>
  • Loading branch information
ypukhta committed Sep 9, 2022
1 parent 190aa2d commit aa5815a
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 943 deletions.
6 changes: 0 additions & 6 deletions cmd/kms-cli/createkeystore/createkeystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ const (

type createKeystoreReq struct {
Controller string `json:"controller"`
EDV *edvOptions `json:"edv"`
}

type edvOptions struct {
VaultURL string `json:"vault_url"`
Capability []byte `json:"capability"`
}

type createKeyStoreResp struct {
Expand Down
2 changes: 1 addition & 1 deletion test/bdd/bddtests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func runBDDTests(tags, format string) int {

func initializeTestSuite(ctx *godog.TestSuiteContext) {
var (
dockerComposeUp = []string{"docker-compose", "-f", composeFilePath, "up", "--force-recreate", "-d"}
dockerComposeUp = []string{"docker-compose", "-f", composeFilePath, "up", "--force-recreate", "-d", "-V"}
dockerComposeDown = []string{"docker-compose", "-f", composeFilePath, "down"}
)

Expand Down
10 changes: 4 additions & 6 deletions test/bdd/features/kms_api.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
Feature: KMS and crypto operations
Background:
Given Key Server is running on "localhost" port "4466"
And AuthZ Key Server is running on "localhost" port "4455"
And Hub Auth is running on "auth.trustbloc.local" port "8070"
And EDV is running on "localhost" port "8081"
And "Alice" wallet has stored secret on Hub Auth
And "Bob" wallet has stored secret on Hub Auth
And "Alice" has created a data vault on EDV for storing keys
And "Bob" has created a data vault on EDV for storing keys
And "Alice" has logged into auth server
And "Bob" has logged into auth server
And "Alice" has created a profile on auth server
And "Bob" has created a profile on auth server

Scenario: User creates a key
Given "Alice" has created an empty keystore on Key Server
Expand Down
10 changes: 4 additions & 6 deletions test/bdd/features/kms_crypto_box_api.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
Feature: KMS CryptoBox operations
Background:
Given Key Server is running on "localhost" port "4466"
And AuthZ Key Server is running on "localhost" port "4455"
And Hub Auth is running on "auth.trustbloc.local" port "8070"
And EDV is running on "localhost" port "8081"
And "Alice" wallet has stored secret on Hub Auth
And "Bob" wallet has stored secret on Hub Auth
And "Alice" has created a data vault on EDV for storing keys
And "Bob" has created a data vault on EDV for storing keys
And "Alice" has logged into auth server
And "Bob" has logged into auth server
And "Alice" has created a profile on auth server
And "Bob" has created a profile on auth server

Scenario: User A anonymously encrypts (wrap as "easy") a payload for User B, User B decrypts (unwrap as "easy open") it
Given "Alice" has created a keystore with "ED25519" key on Key Server
Expand Down
29 changes: 1 addition & 28 deletions test/bdd/features/kms_stress.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,5 @@ Feature: KMS stress test
@kms_stress_local
Scenario: Stress test KMS methods with local storage
When Create "USER_NUMS" users
And "USER_NUMS" users request to create a keystore on "LocalStorage" with "ED25519" key and sign 1 time using "KMS_STRESS_CONCURRENT_REQ" concurrent requests
And "USER_NUMS" users request to create a keystore on "LocalStorage" with "ED25519" key and sign 1 times using "KMS_STRESS_CONCURRENT_REQ" concurrent requests

@kms_stress_authz
Scenario: Stress test authz KMS methods
When AuthZ Key Server is running on "KMS_STRESS_AUTH_KMS_URL" env
And Hub Auth is running on "KMS_STRESS_HUB_AUTH_URL" env
And "John" login with "SUBJECT" and gets "ACCESS_TOKEN" and "SECRET_SHARE" env
And "USER_NUMS" requests to authz kms to create a keystore and a key for user "John" and sign using "KMS_STRESS_CONCURRENT_REQ" concurrent requests

@kms_stress_ops_edv
Scenario: Stress test ops KMS methods with EDV storage
When AuthZ Key Server is running on "KMS_STRESS_AUTH_KMS_URL" env
And Hub Auth is running on "KMS_STRESS_HUB_AUTH_URL" env
And EDV is running on "KMS_STRESS_EDV_URL" env
And "John" login with "SUBJECT" and gets "ACCESS_TOKEN" and "SECRET_SHARE" env
And Create "USER_NUMS" users from prototype "John"
And "USER_NUMS" users has created a data vault on EDV for storing keys
And "USER_NUMS" users request to create a keystore on "EDV" with "ED25519" key and sign 110 times using "KMS_STRESS_CONCURRENT_REQ" concurrent requests


@kms_stress_ops_local
Scenario: Stress test ops KMS methods with EDV storage
When AuthZ Key Server is running on "KMS_STRESS_AUTH_KMS_URL" env
And Hub Auth is running on "KMS_STRESS_HUB_AUTH_URL" env
And EDV is running on "KMS_STRESS_EDV_URL" env
And "John" login with "SUBJECT" and gets "ACCESS_TOKEN" and "SECRET_SHARE" env
And Create "USER_NUMS" users from prototype "John"
And "USER_NUMS" users has created a data vault on EDV for storing keys
And "USER_NUMS" users request to create a keystore on "LocalStorage" with "ED25519" key and sign 110 times using "KMS_STRESS_CONCURRENT_REQ" concurrent requests
3 changes: 0 additions & 3 deletions test/bdd/fixtures/.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ MOCK_LOGIN_CONSENT_IMAGE=mockloginconsent
SIDETREE_MOCK_IMAGE=ghcr.io/trustbloc-cicd/sidetree-mock
SIDETREE_MOCK_IMAGE_TAG=0.7.0-snapshot-799d4d5

EDV_REST_IMAGE=ghcr.io/trustbloc-cicd/edv
EDV_REST_IMAGE_TAG=0.1.9-snapshot-894c500

MONGODB_IMAGE=mongo
MONGODB_IMAGE_TAG=4.0.0
MONGODB_PORT=27017
81 changes: 0 additions & 81 deletions test/bdd/fixtures/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ services:
command: start
depends_on:
- mongodb.example.com
- edv.trustbloc.local
networks:
- bdd_net

Expand Down Expand Up @@ -84,7 +83,6 @@ services:
command: start
depends_on:
- mongodb.example.com
- edv.trustbloc.local
networks:
- bdd_net

Expand All @@ -104,37 +102,6 @@ services:
networks:
- bdd_net

authz-kms.trustbloc.local:
container_name: authz-kms.trustbloc.local
image: ${KMS_SERVER_IMAGE}:latest
environment:
- KMS_HOST=0.0.0.0:8077
- KMS_BASE_URL=https://authz-kms.trustbloc.local:8077
- KMS_TLS_CACERTS=/etc/tls/ec-cacert.pem
- KMS_TLS_SERVE_CERT=/etc/tls/ec-pubCert.pem
- KMS_TLS_SERVE_KEY=/etc/tls/ec-key.pem
- KMS_DATABASE_TYPE=mongodb
- KMS_DATABASE_URL=mongodb://mongodb.example.com:27017
- KMS_DATABASE_PREFIX=authzkms_
- KMS_AUTH_SERVER_URL=https://auth.trustbloc.local:8070
- KMS_AUTH_SERVER_TOKEN=test_token
- KMS_AUTH_DISABLE=true
- KMS_GNAP_HTTPSIG_DISABLE=false
- KMS_CACHE_ENABLE=true
- KMS_LOG_LEVEL=debug
- KMS_SECRET_LOCK_TYPE=local
- KMS_SECRET_LOCK_KEY_PATH=/etc/tls/secret-lock.key
ports:
- 8077:8077
volumes:
- ./keys/tls:/etc/tls
command: start
depends_on:
- mongodb.example.com
- edv.trustbloc.local
networks:
- bdd_net

orb-kms.trustbloc.local:
container_name: orb-kms.trustbloc.local
image: ${KMS_SERVER_IMAGE}:latest
Expand Down Expand Up @@ -165,27 +132,6 @@ services:
command: start
depends_on:
- mongodb.example.com
- edv.trustbloc.local
networks:
- bdd_net

oathkeeper-auth-keyserver.trustbloc.local:
container_name: oathkeeper-auth-keyserver.trustbloc.local
image: oryd/oathkeeper:v0.38.4-alpine
ports:
- 4455:4455
command: /bin/sh -c "cp /etc/tls/ec-cacert.pem /usr/local/share/ca-certificates/;update-ca-certificates;oathkeeper serve proxy --config /oathkeeper/config.yaml"
user: root
entrypoint: ""
environment:
- LOG_LEVEL=debug
- PORT=4455
- ISSUER_URL=https://oathkeeper-proxy.trustbloc.local
- SERVE_PROXY_TLS_KEY_PATH=/etc/tls/ec-key.pem
- SERVE_PROXY_TLS_CERT_PATH=/etc/tls/ec-pubCert.pem
volumes:
- ./oathkeeper-config/auth-keyserver:/oathkeeper
- ./keys/tls:/etc/tls
networks:
- bdd_net

Expand All @@ -209,33 +155,6 @@ services:
networks:
- bdd_net

edv.trustbloc.local:
container_name: edv.trustbloc.local
image: ${EDV_REST_IMAGE}:${EDV_REST_IMAGE_TAG}
environment:
- EDV_HOST_URL=0.0.0.0:8081
- EDV_TLS_CERT_FILE=/etc/tls/ec-pubCert.pem
- EDV_TLS_KEY_FILE=/etc/tls/ec-key.pem
- EDV_DATABASE_TYPE=mongodb
- EDV_DATABASE_URL=mongodb://mongodb.example.com:27017
- EDV_DATABASE_PREFIX=edv_
- EDV_LOCALKMS_SECRETS_DATABASE_TYPE=mongodb
- EDV_LOCALKMS_SECRETS_DATABASE_URL=mongodb://mongodb.example.com:27017
- EDV_LOCALKMS_SECRETS_DATABASE_PREFIX=edv_kms_
- EDV_EXTENSIONS=ReturnFullDocumentsOnQuery,Batch
- EDV_DATABASE_TIMEOUT=60
- EDV_AUTH_ENABLE=true
- EDV_LOG_LEVEL=debug
ports:
- 8081:8081
volumes:
- ./keys/tls:/etc/tls
command: start
depends_on:
- mongodb.example.com
networks:
- bdd_net

auth.trustbloc.local:
container_name: auth.trustbloc.local
image: ${AUTH_REST_IMAGE}:${AUTH_REST_IMAGE_TAG}
Expand Down
1 change: 0 additions & 1 deletion test/bdd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ require (
github.com/trustbloc/auth v0.1.9-0.20220721161924-5a7b16c4282f
github.com/trustbloc/auth/spi/gnap v0.0.0-20220721161924-5a7b16c4282f
github.com/trustbloc/edge-core v0.1.8
github.com/trustbloc/edv v0.1.8
github.com/trustbloc/kms v0.1.9-0.20220526151939-d46e46e8f7e1
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
)
Expand Down
58 changes: 0 additions & 58 deletions test/bdd/pkg/common/common_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ func (s *Steps) SetContext(ctx *context.BDDContext) {
// RegisterSteps defines scenario steps.
func (s *Steps) RegisterSteps(ctx *godog.ScenarioContext) {
ctx.Step(`^Key Server is running on "([^"]*)" port "([^"]*)"$`, s.checkKeyServerIsRun)
ctx.Step(`^AuthZ Key Server is running on "([^"]*)" port "([^"]*)"$`, s.checkAuthzKeyServerIsRun)
ctx.Step(`^EDV is running on "([^"]*)" port "([^"]*)"$`, s.checkEDVServerIsRun)
ctx.Step(`^Hub Auth is running on "([^"]*)" port "([^"]*)"$`, s.checkHubAuthIsRun)

ctx.Step(`^Key Server is running on "([^"]*)" env$`, s.checkKeyServerIsRunEnv)
ctx.Step(`^AuthZ Key Server is running on "([^"]*)" env$`, s.checkAuthzKeyServerIsRunEnv)
ctx.Step(`^EDV is running on "([^"]*)" env$`, s.checkEDVServerIsRunEnv)
ctx.Step(`^Hub Auth is running on "([^"]*)" env$`, s.checkHubAuthIsRunEnv)
}

Expand All @@ -64,28 +60,6 @@ func (s *Steps) checkKeyServerIsRun(host string, port int) error {
return nil
}

func (s *Steps) checkAuthzKeyServerIsRun(host string, port int) error {
url, err := s.healthCheck(host, port)
if err != nil {
return err
}

s.bddContext.AuthZKeyServerURL = url

return nil
}

func (s *Steps) checkEDVServerIsRun(host string, port int) error {
url, err := s.healthCheck(host, port)
if err != nil {
return err
}

s.bddContext.EDVServerURL = url

return nil
}

func (s *Steps) checkHubAuthIsRun(host string, port int) error {
url, err := s.healthCheck(host, port)
if err != nil {
Expand Down Expand Up @@ -114,38 +88,6 @@ func (s *Steps) checkKeyServerIsRunEnv(serverURLEnv string) error {
return nil
}

func (s *Steps) checkAuthzKeyServerIsRunEnv(serverURLEnv string) error {
url, err := getServerURL(serverURLEnv)
if err != nil {
return err
}

err = s.healthCheckURL(url)
if err != nil {
return err
}

s.bddContext.AuthZKeyServerURL = url

return nil
}

func (s *Steps) checkEDVServerIsRunEnv(serverURLEnv string) error {
url, err := getServerURL(serverURLEnv)
if err != nil {
return err
}

err = s.healthCheckURL(url)
if err != nil {
return err
}

s.bddContext.EDVServerURL = url

return nil
}

func (s *Steps) checkHubAuthIsRunEnv(serverURLEnv string) error {
url, err := getServerURL(serverURLEnv)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion test/bdd/pkg/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
type BDDContext struct {
KeyServerURL string
AuthZKeyServerURL string
EDVServerURL string
HubAuthURL string
LoginConfig *auth.LoginConfig
tlsConfig *tls.Config
Expand Down
14 changes: 0 additions & 14 deletions test/bdd/pkg/internal/httputil/httputil.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,6 @@ func WithBody(val []byte) Opt {
}
}

// WithBearerToken specifies an authorization bearer token.
func WithBearerToken(token string) Opt {
return func(o *options) {
o.bearerToken = token
}
}

// WithGNAPToken specifies an authorization GNAP token.
func WithGNAPToken(token string) Opt {
return func(o *options) {
Expand All @@ -181,10 +174,3 @@ func WithSigner(signer requestSigner) Opt {
o.signer = signer
}
}

// WithParsedResponse specifies type to unmarshal response body.
func WithParsedResponse(r interface{}) Opt {
return func(o *options) {
o.parsedResponse = r
}
}
Loading

0 comments on commit aa5815a

Please sign in to comment.