chore(e2e): Ensure ldap is ready (#6736)

* fix(e2e): Modify ldap cleanup step

* chore(e2e): Parallelize dependency download

# Conflicts:
#	.github/workflows/enos-run.yml

* chore(e2e): Ensure ldap is ready
This commit is contained in:
Michael Li authored and GitHub committed 2026-05-21 15:43:33 -04:00
1 parent e19c5472f9
commit c94e386f18
5 files changed
+36 -5

No files matched your search

+1 -1
View File
@@ -263,7 +263,7 @@ jobs:
# environment
# A virtual environment was needed because python environments on
# self-hosted runners are externally managed.
sudo apt install -y python3.12-venv
sudo apt install -y python3-venv
python3 -m venv "$HOME/cqlsh-venv"
"$HOME/cqlsh-venv/bin/pip" install --upgrade pip
"$HOME/cqlsh-venv/bin/pip" install cqlsh
@@ -133,6 +133,8 @@ scenario "e2e_docker_base_plus" {
module = module.test_e2e_docker
depends_on = [
step.create_boundary,
step.create_ldap_server,
step.create_host,
]
variables {
is_ci = var.is_ci
@@ -143,6 +143,7 @@ scenario "e2e_docker_base_with_vault" {
step.create_boundary,
step.create_vault,
step.create_host,
step.create_ldap_server,
]
variables {
is_ci = var.is_ci
+26
View File
@@ -98,6 +98,32 @@ resource "enos_local_exec" "create_ldap_group" {
inline = ["docker exec ${var.container_name} ldapadd -x -H ldap://localhost -D \"${local.admin_dn}\" -w ${local.admin_password} -f /tmp/ldap/group.ldif"]
}
resource "enos_local_exec" "wait_for_user_entry" {
depends_on = [
enos_local_exec.create_ldap_user,
]
inline = [
# First verify the user is discoverable the same way Boundary authenticates it.
"timeout 20s bash -c 'until docker exec ${var.container_name} ldapsearch -x -H ldap://localhost -D \"${local.admin_dn}\" -w ${local.admin_password} -b \"${local.domain_dn}\" \"(uid=${local.user_name})\" | grep \"numEntries: 1\"; do sleep 2; done'",
# Then verify the exact seeded DN exists for Vault static-role operations.
"timeout 20s bash -c 'until docker exec ${var.container_name} ldapsearch -x -H ldap://localhost -D \"${local.admin_dn}\" -w ${local.admin_password} -b \"cn=${local.user_name},${local.domain_dn}\" -s base \"(objectClass=*)\" | grep \"numEntries: 1\"; do sleep 2; done'",
# Finally verify we can bind as the user using the seeded DN shape.
"timeout 20s bash -c 'until docker exec ${var.container_name} ldapwhoami -x -H ldap://localhost -D \"cn=${local.user_name},${local.domain_dn}\" -w ${local.user_password}; do sleep 2; done'"
]
}
resource "enos_local_exec" "wait_for_group_entry" {
depends_on = [
enos_local_exec.create_ldap_group,
]
inline = [
# Verify that the group is discoverable
"timeout 20s bash -c 'until docker exec ${var.container_name} ldapsearch -x -H ldap://localhost -D \"${local.admin_dn}\" -w ${local.admin_password} -b \"${local.domain_dn}\" \"(cn=${local.group_name})\" | grep \"numEntries: 1\"; do sleep 2; done'"
]
}
output "address" {
value = "ldap://${var.container_name}"
}
@@ -86,10 +86,12 @@ func TestApiVaultLdapCredentialLibrary(t *testing.T) {
)
require.NoError(t, output.Err, string(output.Stderr))
output = e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", ldapPolicyName),
)
require.NoError(t, output.Err, string(output.Stderr))
if ldapPolicyName != "" {
output = e2e.RunCommand(ctx, "vault",
e2e.WithArgs("policy", "delete", ldapPolicyName),
)
require.NoError(t, output.Err, string(output.Stderr))
}
})
require.NoError(t, err)