Skip to content
Open
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
18 changes: 14 additions & 4 deletions benchmarktests/target_secret_kvv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/http"
"strconv"
"strings"
"time"

"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-uuid"
Expand Down Expand Up @@ -48,17 +49,19 @@ 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 {
testConfig := &struct {
Config *KVV1SecretTestConfig `hcl:"config,block"`
}{
Config: &KVV1SecretTestConfig{
KVSize: 1,
NumKVs: 1000,
SetupDelay: "1s",
KVSize: 1,
NumKVs: 1000,
},
}

Expand Down Expand Up @@ -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,
Expand Down
19 changes: 15 additions & 4 deletions benchmarktests/target_secret_kvv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ 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 {
testConfig := &struct {
Config *KVV2SecretTestConfig `hcl:"config,block"`
}{
Config: &KVV2SecretTestConfig{
KVSize: 1,
NumKVs: 1000,
SetupDelay: "1s",
KVSize: 1,
NumKVs: 1000,
},
}

Expand Down Expand Up @@ -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,
Expand Down
14 changes: 9 additions & 5 deletions docs/tests/secret-kv.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
```
4 changes: 3 additions & 1 deletion docs/tests/secret-pki-issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 3 additions & 1 deletion docs/tests/secret-pki-sign.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down