Skip to content

Commit

Permalink
Merge pull request #72 from canonical/ci-fix-integration-test
Browse files Browse the repository at this point in the history
test: fix the integration test due to the juju secret id breaking changes
  • Loading branch information
wood-push-melon authored Nov 20, 2024
2 parents 08d0b0c + 7a4944a commit 4855348
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# See LICENSE file for licensing details.

import functools
import re
from contextlib import contextmanager
from pathlib import Path
from typing import Callable, Optional
Expand All @@ -24,6 +25,7 @@
GLAUTH_APP = METADATA["name"]
GLAUTH_IMAGE = METADATA["resources"]["oci-image"]["upstream-source"]
GLAUTH_CLIENT_APP = "any-charm"
JUJU_SECRET_ID_REGEX = re.compile(r"secret:(?://[a-f0-9-]+/)?(?P<secret_id>[a-zA-Z0-9]+)")


@contextmanager
Expand Down Expand Up @@ -129,8 +131,10 @@ async def ldap_configurations(
bind_dn = ldap_integration_data["bind_dn"]
bind_password_secret: str = ldap_integration_data["bind_password_secret"]

prefix, _, secret_id = bind_password_secret.partition(":")
bind_password = await get_secret(ops_test, secret_id or prefix)
matched = JUJU_SECRET_ID_REGEX.match(bind_password_secret)
assert matched is not None, "bind password secret id should be valid"

bind_password = await get_secret(ops_test, matched.group("secret_id"))

return base_dn, bind_dn, bind_password["content"]["password"]

Expand Down

0 comments on commit 4855348

Please sign in to comment.