Skip to content

PYTHON-5275 Fix handling of FIPS build #2266

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

Merged
merged 4 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ functions:
binary: bash
working_dir: "src"
include_expansions_in_env: [VERSION, TOPOLOGY, AUTH, SSL, ORCHESTRATION_FILE, PYTHON_BINARY, PYTHON_VERSION,
STORAGE_ENGINE, REQUIRE_API_VERSION, DRIVERS_TOOLS, TEST_CRYPT_SHARED, AUTH_AWS, LOAD_BALANCER, LOCAL_ATLAS]
STORAGE_ENGINE, REQUIRE_API_VERSION, DRIVERS_TOOLS, TEST_CRYPT_SHARED, AUTH_AWS, LOAD_BALANCER, LOCAL_ATLAS, NO_EXT]
Copy link
Member Author

Choose a reason for hiding this comment

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

This was the actual bug, we weren't passing this var to run-server.

args: [.evergreen/just.sh, run-server, "${TEST_NAME}"]
- command: expansions.update
params:
Expand All @@ -89,7 +89,7 @@ functions:
include_expansions_in_env: [AUTH, SSL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
AWS_SESSION_TOKEN, COVERAGE, PYTHON_BINARY, LIBMONGOCRYPT_URL, MONGODB_URI, PYTHON_VERSION,
DISABLE_TEST_COMMANDS, GREEN_FRAMEWORK, NO_EXT, COMPRESSORS, MONGODB_API_VERSION, DEBUG_LOG,
ORCHESTRATION_FILE, OCSP_SERVER_TYPE, VERSION]
ORCHESTRATION_FILE, OCSP_SERVER_TYPE, VERSION, REQUIRE_FIPS]
binary: bash
working_dir: "src"
args: [.evergreen/just.sh, setup-tests, "${TEST_NAME}", "${SUB_TEST_NAME}"]
Expand Down
1 change: 1 addition & 0 deletions .evergreen/generated_configs/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildvariants:
batchtime: 10080
expansions:
NO_EXT: "1"
REQUIRE_FIPS: "1"
- name: other-hosts-rhel8-zseries
tasks:
- name: .6.0 .standalone !.sync_async
Expand Down
6 changes: 4 additions & 2 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,12 @@ def create_alternative_hosts_variants():
)
)

expansions = dict()
handle_c_ext(C_EXTS[0], expansions)
for host_name in OTHER_HOSTS:
expansions = dict()
handle_c_ext(C_EXTS[0], expansions)
host = HOSTS[host_name]
if "fips" in host_name.lower():
expansions["REQUIRE_FIPS"] = "1"
tags = [".6.0 .standalone !.sync_async"]
if host_name == "Amazon2023":
tags = [f".latest !.sync_async {t}" for t in SUB_TASKS]
Expand Down
1 change: 1 addition & 0 deletions .evergreen/scripts/setup_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"DEBUG_LOG",
"PYTHON_BINARY",
"PYTHON_VERSION",
"REQUIRE_FIPS",
]

# Map the test name to test extra.
Expand Down
2 changes: 2 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ def fips_enabled(self):
self._fips_enabled = True
except (subprocess.SubprocessError, FileNotFoundError):
self._fips_enabled = False
if os.environ.get("REQUIRE_FIPS") and not self._fips_enabled:
raise RuntimeError("Expected FIPS to be enabled")
return self._fips_enabled

def check_auth_type(self, auth_type):
Expand Down
2 changes: 2 additions & 0 deletions test/asynchronous/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ def fips_enabled(self):
self._fips_enabled = True
except (subprocess.SubprocessError, FileNotFoundError):
self._fips_enabled = False
if os.environ.get("REQUIRE_FIPS") and not self._fips_enabled:
raise RuntimeError("Expected FIPS to be enabled")
return self._fips_enabled

def check_auth_type(self, auth_type):
Expand Down
Loading