diff --git a/benchmarktests/target_secret_kvv1.go b/benchmarktests/target_secret_kvv1.go index 3d0625d..44d56b7 100644 --- a/benchmarktests/target_secret_kvv1.go +++ b/benchmarktests/target_secret_kvv1.go @@ -11,6 +11,7 @@ import ( "net/http" "strconv" "strings" + "time" "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-uuid" @@ -48,8 +49,9 @@ type KVV1Test struct { } type KVV1SecretTestConfig struct { - KVSize int `hcl:"kvsize,optional"` - NumKVs int `hcl:"numkvs,optional"` + SetupDelay string `hcl:"setup_delay,optional"` + KVSize int `hcl:"kvsize,optional"` + NumKVs int `hcl:"numkvs,optional"` } func (k *KVV1Test) ParseConfig(body hcl.Body) error { @@ -57,8 +59,9 @@ func (k *KVV1Test) ParseConfig(body hcl.Body) error { Config *KVV1SecretTestConfig `hcl:"config,block"` }{ Config: &KVV1SecretTestConfig{ - KVSize: 1, - NumKVs: 1000, + SetupDelay: "1s", + KVSize: 1, + NumKVs: 1000, }, } @@ -145,6 +148,13 @@ func (k *KVV1Test) Setup(client *api.Client, mountName string, topLevelConfig *T setupLogger := k.logger.Named(mountPath) + // Avoid slow mount setup, seen when waiting for replication in performance replica scenario + delay, err := time.ParseDuration(k.config.SetupDelay) + if err != nil { + return nil, fmt.Errorf("error parsing duration: %v", err) + } + time.Sleep(delay) + secval := map[string]interface{}{ "data": map[string]interface{}{ "foo": 1, diff --git a/benchmarktests/target_secret_kvv2.go b/benchmarktests/target_secret_kvv2.go index af67c86..648f156 100644 --- a/benchmarktests/target_secret_kvv2.go +++ b/benchmarktests/target_secret_kvv2.go @@ -48,8 +48,9 @@ type KVV2Test struct { } type KVV2SecretTestConfig struct { - KVSize int `hcl:"kvsize,optional"` - NumKVs int `hcl:"numkvs,optional"` + SetupDelay string `hcl:"setup_delay,optional"` + KVSize int `hcl:"kvsize,optional"` + NumKVs int `hcl:"numkvs,optional"` } func (k *KVV2Test) ParseConfig(body hcl.Body) error { @@ -57,8 +58,9 @@ func (k *KVV2Test) ParseConfig(body hcl.Body) error { Config *KVV2SecretTestConfig `hcl:"config,block"` }{ Config: &KVV2SecretTestConfig{ - KVSize: 1, - NumKVs: 1000, + SetupDelay: "1s", + KVSize: 1, + NumKVs: 1000, }, } @@ -152,6 +154,15 @@ func (k *KVV2Test) Setup(client *api.Client, mountName string, topLevelConfig *T setupLogger := k.logger.Named(mountPath) + // Avoid slow mount setup, seen when waiting for replication in performance replica scenario: + // URL: PUT $VAULT_ADDR/v1/2fea16ca-42d1-d3a5-d02e-6d1a01d0347e/data/secret-1 + // Code: 404. Errors: * no handler for route "2fea16ca-42d1-d3a5-d02e-6d1a01d0347e/data/secret-1". route entry not found. + delay, err := time.ParseDuration(k.config.SetupDelay) + if err != nil { + return nil, fmt.Errorf("error parsing duration: %v", err) + } + time.Sleep(delay) + secval := map[string]interface{}{ "data": map[string]interface{}{ "foo": 1, diff --git a/docs/tests/secret-kv.md b/docs/tests/secret-kv.md index a624f6c..33c2826 100644 --- a/docs/tests/secret-kv.md +++ b/docs/tests/secret-kv.md @@ -15,17 +15,21 @@ will read from these keys, and the write operations overwrite them. ```hcl test "kvv2_read" "kvv2_read_test" { - weight = 50 + weight = 50 + config { - numkvs = 100 + setup_delay = "2s" + numkvs = 100 } } test "kvv2_write" "kvv2_write_test" { - weight = 50 + weight = 50 + config { - numkvs = 10 - kvsize = 1000 + setup_delay = "2s" + numkvs = 10 + kvsize = 1000 } } ``` diff --git a/docs/tests/secret-pki-issue.md b/docs/tests/secret-pki-issue.md index fc8c9af..4f8bd2d 100644 --- a/docs/tests/secret-pki-issue.md +++ b/docs/tests/secret-pki-issue.md @@ -778,8 +778,10 @@ Additional configuration examples can be found in the [pki configuration directo ```hcl test "pki_issue" "pki_issue_test1" { weight = 100 + config { - setup_delay="2s" + setup_delay = "2s" + root_ca { common_name = "benchmark.test" } diff --git a/docs/tests/secret-pki-sign.md b/docs/tests/secret-pki-sign.md index 73a369a..1244409 100644 --- a/docs/tests/secret-pki-sign.md +++ b/docs/tests/secret-pki-sign.md @@ -790,8 +790,10 @@ Additional configuration examples can be found in the [pki configuration directo ```hcl test "pki_sign" "pki_sign_test1" { weight = 100 + config { - setup_delay="2s" + setup_delay = "2s" + root_ca { common_name = "benchmark.test" }