Skip to content

Commit

Permalink
chore: Add rotate log with DID operations CLI test
Browse files Browse the repository at this point in the history
Add new tests that will:
1. create did, rotate log, update did and check for updated did in rotated log
2. create, update, recover and deactivate did after log rotation and check existence in rotated log

Closes #1391

Signed-off-by: Sandra Vrtikapa <sandra.vrtikapa@securekey.com>
  • Loading branch information
sandrask committed Jul 5, 2022
1 parent 2e6f73f commit 2783ea0
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/config/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var logger = log.New("config-client")

const (
defaultCacheSize = 100
defaultCacheExpiration = time.Minute
defaultCacheExpiration = 5 * time.Second
)

// Client implements retrieving and caching of config store parameters.
Expand All @@ -37,7 +37,7 @@ type Client struct {
unmarshal func([]byte, interface{}) error
}

// New returns a new ActivityPub client.
// New returns a new config store client.
func New(cfg storage.Store, opts ...Option) *Client {
client := &Client{
configStore: cfg,
Expand Down
2 changes: 1 addition & 1 deletion test/bdd/features/did-orb.feature
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Feature:

Then we wait 3 seconds

@vct_log_rotation_test
@vct_log_rotation_REST_test
Scenario: various did doc operations
Given the authorization bearer token for "POST" requests to path "/log" is set to "ADMIN_TOKEN"
And the authorization bearer token for "POST" requests to path "/log-monitor" is set to "ADMIN_TOKEN"
Expand Down
78 changes: 78 additions & 0 deletions test/bdd/features/orb-cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,84 @@ Feature: Using Orb CLI
When Orb DID is deactivated through cli
Then check cli deactivated DID

@orb_cli_did_rotate_log
Scenario: Rotate log, then update existing did followed by create new did and verify proofs in rotated VCT log
# domain2 server follows domain1 server
When user create "follower" activity with outbox-url "https://localhost:48426/services/orb/outbox" actor "https://orb.domain2.com/services/orb" to "https://orb.domain1.com/services/orb" action "Follow"
# domain1 invites domain2 to be a witness
When user create "witness" activity with outbox-url "https://localhost:48326/services/orb/outbox" actor "https://orb.domain1.com/services/orb" to "https://orb.domain2.com/services/orb" action "InviteWitness"
Then we wait 3 seconds

# domain1 will start with 2020 VCT log
When orb-cli is executed with args 'log update --url https://localhost:48326/log --log "http://orb.vct:8077/maple2020" --tls-cacerts fixtures/keys/tls/ec-cacert.pem --auth-token ADMIN_TOKEN'

# wait for config cache to expire
Then we wait 5 seconds

When Create keys in kms
When Orb DID is created through cli
Then check cli created valid DID
And we wait 3 seconds

When Orb DID is resolved through cli
Then the JSON path "didDocumentMetadata.versionId" of the response is saved to variable "anchorHash"
And we wait 3 seconds

When orb-cli is executed with args 'vct verify --cas-url https://localhost:48326/cas --anchor ${anchorHash} --tls-cacerts fixtures/keys/tls/ec-cacert.pem --auth-token ADMIN_TOKEN --vct-auth-token=vctread'
Then the JSON path '#(domain=="http://orb.vct:8077/maple2020").found' of the boolean response equals "true"

# domain1 will then rotate to 2022 VCT log
When orb-cli is executed with args 'log update --url https://localhost:48326/log --log "http://orb.vct:8077/maple2022" --tls-cacerts fixtures/keys/tls/ec-cacert.pem --auth-token ADMIN_TOKEN'

# wait for config cache to expire
Then we wait 5 seconds

When Orb DID is updated through cli
Then check cli updated DID

When Orb DID is resolved through cli
Then the JSON path "didDocumentMetadata.versionId" of the response is saved to variable "anchorHash"
And we wait 3 seconds

When orb-cli is executed with args 'vct verify --cas-url https://localhost:48326/cas --anchor ${anchorHash} --tls-cacerts fixtures/keys/tls/ec-cacert.pem --auth-token ADMIN_TOKEN --vct-auth-token=vctread'
Then the JSON path '#(domain=="http://orb.vct:8077/maple2022").found' of the boolean response equals "true"

# now create new did after log rotation

When Create keys in kms
When Orb DID is created through cli
Then check cli created valid DID
And we wait 3 seconds

When Orb DID is resolved through cli
Then the JSON path "didDocumentMetadata.versionId" of the response is saved to variable "anchorHash"
And we wait 3 seconds

When orb-cli is executed with args 'vct verify --cas-url https://localhost:48326/cas --anchor ${anchorHash} --tls-cacerts fixtures/keys/tls/ec-cacert.pem --auth-token ADMIN_TOKEN --vct-auth-token=vctread'
Then the JSON path '#(domain=="http://orb.vct:8077/maple2022").found' of the boolean response equals "true"

When Orb DID is updated through cli
Then check cli updated DID

When Orb DID is recovered through cli
Then check cli recovered DID

When Orb DID is deactivated through cli
Then check cli deactivated DID

When Orb DID is resolved through cli
Then the JSON path "didDocumentMetadata.versionId" of the response is saved to variable "anchorHash"
And we wait 3 seconds

When orb-cli is executed with args 'vct verify --cas-url https://localhost:48326/cas --anchor ${anchorHash} --tls-cacerts fixtures/keys/tls/ec-cacert.pem --auth-token ADMIN_TOKEN --vct-auth-token=vctread'
Then the JSON path '#(domain=="http://orb.vct:8077/maple2022").found' of the boolean response equals "true"

# re-set to 2020 VCT log for other tests
When orb-cli is executed with args 'log update --url https://localhost:48326/log --log "http://orb.vct:8077/maple2020" --tls-cacerts fixtures/keys/tls/ec-cacert.pem --auth-token ADMIN_TOKEN'

# wait for config cache to expire
Then we wait 5 seconds

@orb_cli_activity
Scenario: test follow and witness
# domain1 server follows domain2 server
Expand Down

0 comments on commit 2783ea0

Please # to comment.