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

tests: disable parsing of system CA certificates in CLI tests #2348

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cli/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::path::{Path, PathBuf};

use itertools::Itertools as _;
use regex::{Captures, Regex};
use tempfile::TempDir;
use testutils;
Expand Down Expand Up @@ -106,10 +107,15 @@ impl TestEnvironment {
cmd.env("JJ_TIMESTAMP", timestamp.to_rfc3339());
cmd.env("JJ_OP_TIMESTAMP", timestamp.to_rfc3339());

#[cfg(all(windows, target_env = "gnu"))]
{
use itertools::Itertools as _;
// libgit2 always initializes OpenSSL, and it takes a few tens of milliseconds
// to load the system CA certificates in X509_load_cert_crl_file_ex(). As we
// don't use HTTPS in our tests, we can disable the cert loading to speed up the
// CLI tests. If we migrated to gitoxide, maybe we can remove this hack.
if cfg!(unix) {
cmd.env("SSL_CERT_FILE", "/dev/null");
}

if cfg!(all(windows, target_env = "gnu")) {
// MinGW executables cannot run without `mingw\bin` in the PATH (which we're
// clearing above), so we add it again here.
if let Ok(path_var) = std::env::var("PATH").or_else(|_| std::env::var("Path")) {
Expand Down