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

GH-783 Fix tests failing on non standard environment #432

Merged
merged 17 commits into from
Apr 24, 2024
Merged

GH-783 Fix tests failing on non standard environment #432

merged 17 commits into from
Apr 24, 2024

Conversation

czarte
Copy link
Collaborator

@czarte czarte commented Apr 2, 2024

No description provided.

@czarte czarte assigned czarte and bertllll and unassigned czarte and bertllll Apr 2, 2024
@czarte czarte requested a review from bertllll April 2, 2024 17:29
.to_string_lossy()
.to_string(),
);
let _create_data_dir = create_dir_all(&data_dir);
let config_file_relative = File::create(data_dir.join("config.toml")).unwrap();
fill_up_config_file(config_file_relative);
let env_vec_array = vec![
Copy link
Contributor

Choose a reason for hiding this comment

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

I cannot write it lower than here but I continue to think that the DirsWrapperMock doesn't belong in here, it should only be the real one. The code should figure out home_dir and data_dir on its own, genuinely. It would be possible that the test wouldn't pass for that reason of what the tests claims but just because you determined it by these supplied values in the Mock. If I'm wrong and the test fails then... I'd be disappointed... but I think we'll have to think that out even further.

"node_configurator_standard",
"tilde_in_config_file_path_from_commandline_and_args_uploaded_from_config_file",
);
let home_dir = base_dir.clone();
Copy link
Contributor

Choose a reason for hiding this comment

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

I might have overlooked, it is possible, but it seems to me that you actually don't need to create this "base_dir" first and then the "home_dir". I might be able to write directly:

      let home_dir = ensure_node_home_directory_exists(
            "node_configurator_standard",
            "tilde_in_config_file_path_from_commandline_and_args_uploaded_from_config_file",
        );

.expect("expect home dir")
.join("masqhome")
.join("config.toml");
let mut config_file = File::create(&config_file_path).unwrap();
config_file
.write_all(b"blockchain-service-url = \"https://www.mainnet.com\"\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

I mentioned it at the other test already, please try eliminating the DirsWrapperMock.

@czarte czarte merged commit 6047a13 into master Apr 24, 2024
6 checks passed
@czarte czarte deleted the GH-783 branch April 24, 2024 10:38
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