Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

turn dns_test::{subject,peer} into immutable statics #43

Merged
merged 1 commit into from
May 22, 2024

Conversation

japaric
Copy link
Collaborator

@japaric japaric commented Mar 11, 2024

using std::env::set_var to set or change the value of either DNS_TEST_SUBJECT or DNS_TEST_PEER is A Bad Idea, specially so when tests are running in parallel

we can't forbid the use of env::set_var but at least we can ensure that even in its presence the return value of dns_test::{subject,peer} will not change

this is accomplished using a "lazy" static variable that gets initialized at most once during the lifetime of the process instead of reading the env var each time {subject,peer} is called

to better convey the fact that the return value of {subject,peer} won't change, we present them as static variables instead

@japaric japaric force-pushed the ja-immutable-subject-peer branch 2 times, most recently from 4d1b22e to 82bd0e2 Compare April 22, 2024 15:57
using `std::env::set_var` to set or change the value of either
DNS_TEST_SUBJECT or DNS_TEST_PEER  is A Bad Idea, specially so when
tests  are running in parallel

we can't forbid the use of `env::set_var` _but_ at least we can ensure
that even in its presence the return value of `dns_test::{subject,peer}`
will not change

this is accomplished using a "lazy" static variable that gets
initialized at most once during the lifetime of the process instead of
reading the env var each time `{subject,peer}` is called

to better convey the fact that the return value of `{subject,peer}`
won't change, we present them as static variables instead
@japaric japaric force-pushed the ja-immutable-subject-peer branch from 82bd0e2 to 5823902 Compare May 22, 2024 12:03
@japaric japaric merged commit 76d308c into main May 22, 2024
1 check passed
@japaric japaric deleted the ja-immutable-subject-peer branch May 22, 2024 12:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants