Skip to content

Allow injecting certificate for tests - #615

Merged
zanieb merged 1 commit into
zb/offlinepifrom
konsti/test-certificate
Dec 14, 2023
Merged

zanieb merged 1 commit into
zb/offlinepifrom
konsti/test-certificate

Conversation

@konstin

@konstin konstin commented Dec 12, 2023

Copy link
Copy Markdown
Member

Built on #609

When activating the puffin-test-custom-ca-cert feature, you can inject a custom ssl certificate by setting PUFFIN_TEST_CA_CERT_PEM to a pem file, e.g.

PUFFIN_TEST_CA_CERT_PEM=$(pwd)/mitmproxy-ca-cert.pem ./offlinepi record cargo test --features pypi --features puffin-test-custom-ca-cert -- --test-threads=1 

This feature is off by default, so this is not possible in release builds.

Built on #609

When activating the `puffin-test-custom-ca-cert` feature, you can inject a custom ssl certificate by setting `PUFFIN_TEST_CA_CERT_PEM` to a pem file, e.g.

```bash
PUFFIN_TEST_CA_CERT_PEM=$(pwd)/mitmproxy-ca-cert.pem ./offlinepi record cargo test --features pypi --features puffin-test-custom-ca-cert -- --test-threads=1
```

This feature is off by default, so this is not possible in release builds.
@konstin
konstin requested a review from zanieb December 12, 2023 10:50
@konstin

konstin commented Dec 12, 2023

Copy link
Copy Markdown
Member Author
PUFFIN_TEST_CA_CERT_PEM=$(pwd)/mitmproxy-ca-cert.pem ./offlinepi replay cargo test --features pypi --features puffin-test-custom-ca-cert --test resolver

Raises "SIGSEGV: invalid memory reference" 😵‍💫

@konstin
konstin marked this pull request as draft December 12, 2023 11:07
@zanieb

zanieb commented Dec 12, 2023

Copy link
Copy Markdown
Member

Some commentary at #609 (comment)

I like this, but also think we need a user-facing way to use system certs.

@konstin

konstin commented Dec 12, 2023

Copy link
Copy Markdown
Member Author

I think those are two separate issues; I also wouldn't recommend people to change their system trust store to run puffin unit tests.

@konstin
konstin marked this pull request as ready for review December 12, 2023 17:53
@konstin

konstin commented Dec 12, 2023

Copy link
Copy Markdown
Member Author

I think this PR is fine, but the segfault is a problem in general

@zanieb

zanieb commented Dec 12, 2023

Copy link
Copy Markdown
Member

Yeah the segfault seems non-deterministic and more likely to occur with parallelism

@zanieb
zanieb changed the base branch from main to zb/offlinepi December 14, 2023 18:27
@zanieb
zanieb merged commit d397401 into zb/offlinepi Dec 14, 2023
@zanieb
zanieb deleted the konsti/test-certificate branch December 14, 2023 18:27
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.

2 participants