From 69522333ac4a4cee0798177ec2d065fee9632608 Mon Sep 17 00:00:00 2001 From: Sean Ellefson Date: Thu, 15 Oct 2026 14:49:50 -0700 Subject: [PATCH 1/3] Adding `secret_id_count` to AppRole test --- benchmarktests/target_auth_approle.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/benchmarktests/target_auth_approle.go b/benchmarktests/target_auth_approle.go index 30e8a110..b9c15f66 100644 --- a/benchmarktests/target_auth_approle.go +++ b/benchmarktests/target_auth_approle.go @@ -44,6 +44,7 @@ type RoleConfig struct { SecretIDBoundCIDRS []string `hcl:"secret_id_bound_cidrs,optional"` SecretIDNumUses int `hcl:"secret_id_num_uses,optional"` SecretIDTTL string `hcl:"secret_id_ttl,optional"` + SecretIDCount int `hcl:"secret_id_count,optional"` LocalSecretIDs bool `hcl:"local_secret_ids,optional"` TokenTTL string `hcl:"token_ttl,optional"` TokenMaxTTL string `hcl:"token_max_ttl,optional"` @@ -82,6 +83,12 @@ func (a *ApproleAuth) ParseConfig(body hcl.Body) error { return fmt.Errorf("error decoding to struct: %v", diags) } a.config = testConfig.Config + a.config = c + + if c.SecretIDCount < 0 { + return fmt.Errorf("secret_id_count must be >= 0") + } + return nil } @@ -131,6 +138,14 @@ func (a *ApproleAuth) Setup(client *api.Client, mountName string, topLevelConfig roleID := roleIDSecret.Data["role_id"].(string) secretID := secretId.Data["secret_id"].(string) + setupLogger.Debug("generating remaining secret-ids") + for remainingSecretIDs := a.config.SecretIDCount - 1; remainingSecretIDs > 0; remainingSecretIDs-- { + secretId, err := client.Logical().Write(rolePath+"/secret-id", secretIDData) + if err != nil { + return nil, fmt.Errorf("error generating approle secret-id: %v", err) + } + } + return &ApproleAuth{ header: generateHeader(client), pathPrefix: "/v1/" + filepath.Join("auth", authPath), From a5a9e1f152a4eb0cc2b14292b95529b049b7d222 Mon Sep 17 00:00:00 2001 From: Sean Ellefson Date: Thu, 15 Oct 2026 16:19:05 -0700 Subject: [PATCH 2/3] Moving `secret_id_count` to top-level parameter to avoid running afoul of hclparse --- benchmarktests/target_auth_approle.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/benchmarktests/target_auth_approle.go b/benchmarktests/target_auth_approle.go index b9c15f66..a4bfb384 100644 --- a/benchmarktests/target_auth_approle.go +++ b/benchmarktests/target_auth_approle.go @@ -36,6 +36,7 @@ type ApproleAuth struct { type ApproleAuthConfig struct { RoleConfig *RoleConfig `hcl:"role,block"` SecretIDConfig *SecretIDConfig `hcl:"secret_id,block"` + SecretIDCount int `hcl:"secret_id_count,optional"` } type RoleConfig struct { @@ -44,7 +45,6 @@ type RoleConfig struct { SecretIDBoundCIDRS []string `hcl:"secret_id_bound_cidrs,optional"` SecretIDNumUses int `hcl:"secret_id_num_uses,optional"` SecretIDTTL string `hcl:"secret_id_ttl,optional"` - SecretIDCount int `hcl:"secret_id_count,optional"` LocalSecretIDs bool `hcl:"local_secret_ids,optional"` TokenTTL string `hcl:"token_ttl,optional"` TokenMaxTTL string `hcl:"token_max_ttl,optional"` @@ -83,7 +83,7 @@ func (a *ApproleAuth) ParseConfig(body hcl.Body) error { return fmt.Errorf("error decoding to struct: %v", diags) } a.config = testConfig.Config - a.config = c + c := a.config if c.SecretIDCount < 0 { return fmt.Errorf("secret_id_count must be >= 0") @@ -140,7 +140,8 @@ func (a *ApproleAuth) Setup(client *api.Client, mountName string, topLevelConfig setupLogger.Debug("generating remaining secret-ids") for remainingSecretIDs := a.config.SecretIDCount - 1; remainingSecretIDs > 0; remainingSecretIDs-- { - secretId, err := client.Logical().Write(rolePath+"/secret-id", secretIDData) + secretIDData, err := structToMap(a.config.SecretIDConfig) + _, err = client.Logical().Write(rolePath+"/secret-id", secretIDData) if err != nil { return nil, fmt.Errorf("error generating approle secret-id: %v", err) } From 9506d81556c1f988dadc9f7faadd1b0bcd31b695 Mon Sep 17 00:00:00 2001 From: Sean Ellefson Date: Thu, 15 Oct 2026 16:32:38 -0700 Subject: [PATCH 3/3] Adding doc entry for `secret_id_count` --- docs/tests/auth-approle.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/tests/auth-approle.md b/docs/tests/auth-approle.md index 67642e40..6af4797d 100644 --- a/docs/tests/auth-approle.md +++ b/docs/tests/auth-approle.md @@ -4,6 +4,10 @@ This benchmark tests the performance of logins using the AppRole auth method. ## Benchmark Configuration Parameters +- `secret_id_count` `(integer: 0)` - Number of secret IDs to create during the + setup phase. These secret IDs are not used for the login, just populate + under the mount generated per test. + ### Role Configuration (`role`) - `role_name` `(string: "benchmark-role")` - Name of the AppRole. Must be less than 4096 bytes, accepted characters