Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: Add rotate log with DID operations CLI test #1393

Merged
merged 1 commit into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
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