Skip to content

Commit d430306

Browse files
Merge remote-tracking branch 'remotes/from/ce/main'
2 parents f8df539 + a3bc0a3 commit d430306

16 files changed

Lines changed: 1001 additions & 21 deletions

.github/workflows/test-run-enos-scenario-matrix.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ jobs:
203203
- uses: ./.github/actions/set-up-go
204204
with:
205205
github-token: ${{ steps.secrets.outputs.github-token }}
206+
- name: Install LDAP client tools
207+
run: |
208+
sudo apt-get update
209+
sudo apt-get install -y ldap-utils
206210
- uses: ./.github/actions/install-tools
207211
- uses: hashicorp/setup-terraform@5e8dbf3c6d9deaf4193ca7a8fb23f2ac83bb6c85 # v4.0.0
208212
with:

enos/enos-samples-ce-build.hcl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ sample "build_ce_linux_amd64_deb" {
2424
}
2525
}
2626

27-
2827
subset "proxy" {
2928
matrix {
3029
arch = ["amd64"]
@@ -69,7 +68,6 @@ sample "build_ce_linux_arm64_deb" {
6968
}
7069
}
7170

72-
7371
subset "proxy" {
7472
matrix {
7573
arch = ["arm64"]
@@ -114,7 +112,6 @@ sample "build_ce_linux_arm64_rpm" {
114112
}
115113
}
116114

117-
118115
subset "proxy" {
119116
matrix {
120117
arch = ["arm64"]
@@ -159,7 +156,6 @@ sample "build_ce_linux_amd64_rpm" {
159156
}
160157
}
161158

162-
163159
subset "proxy" {
164160
matrix {
165161
arch = ["amd64"]
@@ -210,7 +206,6 @@ sample "build_ce_linux_amd64_zip" {
210206
}
211207
}
212208

213-
214209
subset "proxy" {
215210
matrix {
216211
arch = ["amd64"]
@@ -255,7 +250,6 @@ sample "build_ce_linux_arm64_zip" {
255250
}
256251
}
257252

258-
259253
subset "proxy" {
260254
matrix {
261255
arch = ["arm64"]

enos/enos-samples-ce-release.hcl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ sample "release_ce_linux_amd64_deb" {
2424
}
2525
}
2626

27-
2827
subset "proxy" {
2928
matrix {
3029
arch = ["amd64"]
@@ -69,7 +68,6 @@ sample "release_ce_linux_arm64_deb" {
6968
}
7069
}
7170

72-
7371
subset "proxy" {
7472
matrix {
7573
arch = ["arm64"]
@@ -114,7 +112,6 @@ sample "release_ce_linux_arm64_rpm" {
114112
}
115113
}
116114

117-
118115
subset "proxy" {
119116
matrix {
120117
arch = ["arm64"]
@@ -159,7 +156,6 @@ sample "release_ce_linux_amd64_rpm" {
159156
}
160157
}
161158

162-
163159
subset "proxy" {
164160
matrix {
165161
arch = ["amd64"]
@@ -204,7 +200,6 @@ sample "release_ce_linux_amd64_zip" {
204200
}
205201
}
206202

207-
208203
subset "proxy" {
209204
matrix {
210205
arch = ["amd64"]
@@ -249,7 +244,6 @@ sample "release_ce_linux_arm64_zip" {
249244
}
250245
}
251246

252-
253247
subset "proxy" {
254248
matrix {
255249
arch = ["arm64"]

enos/enos-scenario-plugin.hcl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ scenario "plugin" {
66
The plugin scenario deploys a Vault cluster with external integration services and runs comprehensive
77
plugin blackbox tests. This scenario validates plugin functionality including:
88
9+
- LDAP secrets engine: Static/dynamic roles, password policies, rotation, rollback scenarios
10+
- Future plugins: Database, SSH, PKI, and other secrets engines
11+
912
The scenario creates dedicated external services (LDAP, databases, etc.) using containers and
1013
configures them with test data required for comprehensive plugin testing.
1114
@@ -92,7 +95,12 @@ scenario "plugin" {
9295
ubuntu = provider.enos.ubuntu
9396
}
9497
manage_service = matrix.artifact_type == "bundle"
95-
test_names = ["TestAlwaysPass"]
98+
test_names = {
99+
ldap = ["TestLDAPSecretsEngineComprehensive"]
100+
// database = ["TestDatabaseSecretsEngineComprehensive"] // Future
101+
// ssh = ["TestSSHSecretsEngineComprehensive"] // Future
102+
// pki = ["TestPKISecretsEngineComprehensive"] // Future
103+
}
96104
}
97105

98106
step "build_vault" {
@@ -477,8 +485,8 @@ scenario "plugin" {
477485
leader_host = step.get_vault_cluster_ips.leader_host
478486
leader_public_ip = step.get_vault_cluster_ips.leader_public_ip
479487
vault_root_token = step.create_vault_cluster.root_token
480-
test_names = local.test_names
481-
test_package = "./vault/external_tests/blackbox/plugin"
488+
test_names = local.test_names["ldap"] // Update this to select different plugin tests based on scenario configuration
489+
test_package = "./vault/external_tests/blackbox/ldap"
482490
integration_host_state = step.set_up_plugin_services.state
483491
vault_edition = matrix.edition
484492
}

enos/modules/vault_run_blackbox_test/main.tf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ locals {
5252
domain_dn = try(local.ldap_config.domain, "") != "" ? join(",", [for part in split(".", local.ldap_config.domain) : "dc=${part}"]) : ""
5353

5454
# Set up LDAP environment variables when LDAP integration is available
55+
# LDAP_SERVER uses private_ip for Vault operations (runs on Vault leader host)
56+
# LDAP_SERVER_PUBLIC uses public_ip for test setup operations (runs from GitHub runner)
5557
ldap_environment = try(local.ldap_config.domain, "") != "" ? {
56-
LDAP_SERVER = "ldap://${local.ldap_config.host.private_ip}:${local.ldap_config.port}"
57-
LDAP_BIND_DN = "cn=admin,${local.domain_dn}"
58-
LDAP_BIND_PASS = local.ldap_config.admin_pw
58+
LDAP_SERVER = local.ldap_config.host.private_ip
59+
LDAP_SERVER_PUBLIC = local.ldap_config.host.public_ip
60+
LDAP_PORT = tostring(local.ldap_config.port)
61+
LDAP_BIND_DN = "cn=admin,${local.domain_dn}"
62+
LDAP_BIND_PASS = local.ldap_config.admin_pw
5963
} : {}
6064
}
6165

enos/modules/vault_run_blackbox_test/plugin.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ variable "plugin_config" {
1515
}
1616
}
1717

18+
1819
# Local variables for plugin environment setup
1920
locals {
2021
plugin_environment = var.plugin_config.enabled ? {

sdk/helper/testcluster/blackbox/session.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os"
1111
"path"
1212
"testing"
13+
"time"
1314

1415
"github.com/hashicorp/vault/api"
1516
"github.com/stretchr/testify/require"
@@ -37,6 +38,7 @@ func New(t *testing.T) *Session {
3738

3839
config := api.DefaultConfig()
3940
config.Address = addr
41+
config.Timeout = 120 * time.Second // Increase timeout for LDAP operations that verify service accounts
4042

4143
privClient, err := api.NewClient(config)
4244
require.NoError(t, err)

sdk/helper/testcluster/blackbox/session_util.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,24 @@ import (
1212

1313
// Eventually retries the function 'fn' until it returns nil or timeout occurs.
1414
func (s *Session) Eventually(fn func() error) {
15+
s.EventuallyWithTimeout(fn, 5*time.Second)
16+
}
17+
18+
// EventuallyWithTimeout retries the function 'fn' until it returns nil or timeout occurs.
19+
// Use this for operations that may take longer than the default 5 seconds.
20+
func (s *Session) EventuallyWithTimeout(fn func() error, timeout time.Duration) {
1521
s.t.Helper()
1622

17-
timeout := time.After(5 * time.Second)
23+
timeoutChan := time.After(timeout)
1824
ticker := time.NewTicker(200 * time.Millisecond)
1925
defer ticker.Stop()
2026

2127
var lastErr error
2228

2329
for {
2430
select {
25-
case <-timeout:
26-
s.t.Fatalf("Eventually failed after 5s. Last error: %v", lastErr)
31+
case <-timeoutChan:
32+
s.t.Fatalf("Eventually failed after %v. Last error: %v", timeout, lastErr)
2733
case <-ticker.C:
2834
lastErr = fn()
2935
if lastErr == nil {

0 commit comments

Comments
 (0)