Skip to content

Always use the certs from the quadlet machine in the tests - #703

Merged
evgeni merged 3 commits into
masterfrom
use-the-certs
Jul 31, 2026
Merged

Always use the certs from the quadlet machine in the tests#703
evgeni merged 3 commits into
masterfrom
use-the-certs

Conversation

@evgeni

@evgeni evgeni commented Jul 24, 2026

Copy link
Copy Markdown
Member

Why are you introducing these changes? (Problem description, related links)

Our tests talk to the Smart Proxy API (see #519 and the BMC change in this PR), which requires auth. In the case of an external proxy deployment, the certs that were used were of the proxy, but that is not allowed to auth against itself.

What are the changes introduced in this pull request?

  • Fetch the certs from the quadlet machine and use those

How to test this pull request

Steps to reproduce:

  • See the BMC feature test work on external proxy

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

Comment thread tests/conftest.py
@pytest.fixture(scope="module")
def curl_request(server, certificates, server_fqdn):
def curl_request(server, certificates, quadlet_client_certificate, server_fqdn):
cert, key = quadlet_client_certificate

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check if there are cases where we actually want the proxy cert here, but we should do that before merging

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to test server APIs that are reserved for proxy auth, for example fact upload.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but we don't have such a test here today.

@evgeni evgeni changed the title Use the certs Always use the certs from the quadlet machine in the tests Jul 27, 2026
@evgeni
evgeni marked this pull request as ready for review July 27, 2026 09:10
@evgeni

evgeni commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Upgrade failure unrelated, fix in #705

Comment thread tests/conftest.py
@pytest.fixture(scope="module")
def curl_request(server, certificates, server_fqdn):
def curl_request(server, certificates, quadlet_client_certificate, server_fqdn):
cert, key = quadlet_client_certificate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to test server APIs that are reserved for proxy auth, for example fact upload.

Comment thread tests/conftest.py

@pytest.fixture(scope="module")
def curl_request(server, certificates, server_fqdn):
def curl_request(server, certificates, quadlet_client_certificate, server_fqdn):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def curl_request(server, certificates, quadlet_client_certificate, server_fqdn):
def curl_request(server, certificates, client_certificate=quadlet_client_certificate, server_fqdn):

This will enable a sane default with ability to properly override

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are Pytest fixtures, not normal Python args, I don't think you can override them like this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, tests say that doesn't work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for pytest you can do it like this:

@pytest.fixture
def client_certificate
  return quadlet_client_certificate

This will be the default, and later, if you want to change the value, you will do something like:

@pytest.mark.parameterize("client_certificate", ["/path/to/host/cert"])
def test_facts(curl_request)
# ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests still say no:

TypeError: cannot unpack non-iterable FixtureFunctionDefinition object

Can we use my working code and worry about possible overrides later when we actually need them?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, let's get a working version out and worry about the overrides later

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the last commit again.

@evgeni

evgeni commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

Given @ShimShtein is out today, and the override was his only concern, I am going to merge this, to unblock #706

There was also a concern raised by @jeremylenz about the hard-coded "quadlet" name here, which I will follow up in a separate PR.

@evgeni
evgeni merged commit bb11b38 into master Jul 31, 2026
27 of 29 checks passed
@evgeni
evgeni deleted the use-the-certs branch July 31, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants