Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Do not set environment variables in tests #2008

Merged
merged 2 commits into from
Jun 24, 2020
Merged

Do not set environment variables in tests #2008

merged 2 commits into from
Jun 24, 2020

Conversation

jgrund
Copy link
Member

@jgrund jgrund commented Jun 23, 2020

We have a number of intermittently failing tests that are due to setting environment variables within the tests.

Rust tests run in parallel and the environment is basically a singleton. Therefore, these tests leak state with each other and are non-deterministic.

In addition, we are pulling items between action plugins, where we could factor it out into the env instead.

Fixes #1826.

Signed-off-by: Joe Grund jgrund@whamcloud.io


This change is Reviewable

We have a number of intermittently failing tests that are due to setting environment variables within the tests.

Rust tests run in parallel and the environment is basically a singleton. Therefore, these tests leak state with each other and are non-deterministic.

In addition, we are pulling items between action plugins, where we could factor it out into the env instead.

Fixes #1826.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
@jgrund jgrund requested a review from a team June 23, 2020 19:09
@jgrund jgrund self-assigned this Jun 23, 2020
Copy link
Member

@ip1981 ip1981 left a comment

Choose a reason for hiding this comment

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

The root of the problem is that one plugin needs to know about another.

iml-agent/src/action_plugins/lamigo.rs Show resolved Hide resolved
@@ -125,7 +126,9 @@ mod lpurge_conf_tests {
freelo: 60,
mailbox: "foobar".to_string(),
};
let file = conf_name(&cfg).await.expect("name could not be created");
let file = conf_name(&cfg, "/etc/lpurge/{fs}/{ost}-{pool}.conf")
Copy link
Member

Choose a reason for hiding this comment

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

👍

write!(
f,
impl Config {
fn generate_unit(&self, socket: String) -> String {
Copy link
Member

Choose a reason for hiding this comment

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

I think this could be unified with expand_path_fmt: we just format strings, file name of content.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you expand on how the unification would work? One item is generating a systemd unit the other is generating a path with optional values.

Are you suggesting to use strfmt for both fns?

Copy link
Member

@ip1981 ip1981 Jun 24, 2020

Choose a reason for hiding this comment

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

Yes, strfmt for both. Even maybe in one pass, like cfg.write(socket, file_name_template);

@ip1981
Copy link
Member

ip1981 commented Jun 23, 2020

There are some unused imports.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
@jgrund jgrund merged commit da83073 into master Jun 24, 2020
@jgrund jgrund deleted the pass-in-deps branch June 24, 2020 19:27
jgrund added a commit that referenced this pull request Jun 25, 2020
* Do not set environment variables in tests

We have a number of intermittently failing tests that are due to setting environment variables within the tests.

Rust tests run in parallel and the environment is basically a singleton. Therefore, these tests leak state with each other and are non-deterministic.

In addition, we are pulling items between action plugins, where we could factor it out into the env instead.

Fixes #1826.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>

* Remove unused imports

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants