Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip password auth tests if not supported by LXD #588

Merged
merged 2 commits into from
Jun 19, 2024
Merged
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
8 changes: 6 additions & 2 deletions integration/run-integration-tests
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ fi
# Make sure a client.{crt,key} exist by trying to add a bogus remote
lxc remote add foo 127.0.0.1:1234 2>/dev/null || true

lxc config set core.trust_password password
if ! lxc query /1.0 | grep -q '"explicit_trust_token"$'; then
lxc config set core.trust_password password
fi
lxc config set core.https_address 127.0.0.1

if ! lxc storage show default >/dev/null 2>&1; then
Expand Down Expand Up @@ -62,5 +64,7 @@ for cert in $(comm -13 "${OLD_TRUST_LIST}" "${NEW_TRUST_LIST}"); do
done
rm -f "${OLD_TRUST_LIST}" "${NEW_TRUST_LIST}"

lxc config unset core.trust_password || true
if ! lxc query /1.0 | grep -q '"explicit_trust_token"$'; then
lxc config unset core.trust_password || true
fi
lxc config unset core.https_address || true
10 changes: 10 additions & 0 deletions integration/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class TestClient(IntegrationTestCase):
"""Tests for `Client`."""

def test_authenticate(self):
if self.client.has_api_extension("explicit_trust_token"):
self.skipTest(
"Required LXD support for password authentication not available!"
)

client = pylxd.Client("https://127.0.0.1:8443/")

self.assertFalse(client.trusted)
Expand All @@ -30,6 +35,11 @@ def test_authenticate(self):
self.assertTrue(client.trusted)

def test_authenticate_with_project(self):
if self.client.has_api_extension("explicit_trust_token"):
self.skipTest(
"Required LXD support for password authentication not available!"
)

try:
client = pylxd.Client("https://127.0.0.1:8443/", project="test-project")
except exceptions.ClientConnectionFailed as e:
Expand Down