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

bazel/test: use RP_FIXTURE_ENV=1 for all unit tests #24989

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

bashtanov
Copy link
Contributor

We do not distinguish betwee unit and fixture tests in bazel, but fixture tests need RP_FIXTURE_ENV=1 to make adjustments for running multiple shards on the same thread. Add it for all tests.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.3.x
  • v24.2.x
  • v24.1.x

Release Notes

  • none

Copy link
Contributor

@michael-redpanda michael-redpanda left a comment

Choose a reason for hiding this comment

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

Thanks @bashtanov ! cc'ing @dotnwat and @rockwotj to make sure they're kosher with this global change.

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Jan 31, 2025

CI test results

test results on build#61432
test_id test_kind job_url test_status passed
gtest_raft_rpunit.gtest_raft_rpunit unit https://buildkite.com/redpanda/redpanda/builds/61432#0194bbe0-21de-40ec-93e1-38369f0b51dc FLAKY 1/2
rptest.tests.compaction_recovery_test.CompactionRecoveryTest.test_index_recovery ducktape https://buildkite.com/redpanda/redpanda/builds/61432#0194bc23-365e-4b1b-a7ec-f9f9fcce1196 FLAKY 1/2
rptest.tests.compaction_recovery_test.CompactionRecoveryUpgradeTest.test_index_recovery_after_upgrade ducktape https://buildkite.com/redpanda/redpanda/builds/61432#0194bc28-6b06-4bc8-adfe-e2f9a15fb5c4 FLAKY 1/2
rptest.tests.datalake.compaction_test.CompactionGapsTest.test_translation_no_gaps.cloud_storage_type=CloudStorageType.S3 ducktape https://buildkite.com/redpanda/redpanda/builds/61432#0194bc28-6b06-4bc8-adfe-e2f9a15fb5c4 FLAKY 1/2
rptest.tests.datalake.custom_partitioning_test.DatalakeCustomPartitioningTest.test_basic.cloud_storage_type=CloudStorageType.S3.filesystem_catalog_mode=False ducktape https://buildkite.com/redpanda/redpanda/builds/61432#0194bc23-365d-48a5-aefb-7ac3fce05566 FLAKY 1/2
rptest.tests.datalake.datalake_e2e_test.DatalakeE2ETests.test_topic_lifecycle.cloud_storage_type=CloudStorageType.S3.filesystem_catalog_mode=False ducktape https://buildkite.com/redpanda/redpanda/builds/61432#0194bc23-365e-4b1b-a7ec-f9f9fcce1196 FLAKY 1/2
rptest.tests.partition_state_api_test.PartitionStateAPItest.test_local_summary ducktape https://buildkite.com/redpanda/redpanda/builds/61432#0194bc23-365f-45a3-bb14-9323fe17c210 FLAKY 1/2
rptest.tests.scaling_up_test.ScalingUpTest.test_scaling_up_with_recovered_topic ducktape https://buildkite.com/redpanda/redpanda/builds/61432#0194bc28-6b08-450f-8b91-299ef6a58a2b FLAKY 1/3
test results on build#61450
test_id test_kind job_url test_status passed
rptest.tests.compaction_recovery_test.CompactionRecoveryUpgradeTest.test_index_recovery_after_upgrade ducktape https://buildkite.com/redpanda/redpanda/builds/61450#0194bded-abc1-4f0b-9d79-cc0f3e0c516b FLAKY 1/2
test results on build#61610
test_id test_kind job_url test_status passed
rptest.tests.compaction_recovery_test.CompactionRecoveryUpgradeTest.test_index_recovery_after_upgrade ducktape https://buildkite.com/redpanda/redpanda/builds/61610#0194d63d-9952-415f-a4ac-844a61b66e20 FLAKY 1/2
rptest.tests.partition_movement_test.SIPartitionMovementTest.test_shadow_indexing.num_to_upgrade=0.cloud_storage_type=CloudStorageType.ABS ducktape https://buildkite.com/redpanda/redpanda/builds/61610#0194d642-ba05-4034-84d4-fecf19f13d6f FLAKY 1/2

rockwotj
rockwotj previously approved these changes Jan 31, 2025
Copy link
Contributor

@rockwotj rockwotj left a comment

Choose a reason for hiding this comment

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

This is fine. I would have a slight preference for not baking this into our tests so universally so that people don't add more of this "testonly" backdoor, but we can always change this later. Thanks for fixing!

@@ -364,7 +364,8 @@ is_fips_mode ossl_context_service::fips_mode() const {
}

bool ossl_context_service::in_rp_fixture_test() const {
return ::getenv("RP_FIXTURE_ENV") != nullptr;
char* val = ::getenv("RP_FIXTURE_ENV");
return val != nullptr && *val != '\0';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit I would rather check for a known explicit value here (1 yes or anything really) instead of just empty vs non empty

@bashtanov bashtanov dismissed stale reviews from rockwotj and michael-redpanda via ae1d90b January 31, 2025 18:11
@bashtanov bashtanov force-pushed the bazel-tests-rp-fixture-env branch from 86c6c42 to ae1d90b Compare January 31, 2025 18:11
rockwotj
rockwotj previously approved these changes Jan 31, 2025
@@ -168,7 +168,7 @@ redpanda_cc_gtest(
cpu = 2,
data = common_data_deps,
defines = ["FIPS_MODULE_REQUIRED"],
env = common_env,
env = common_env | {"RP_FIXTURE_ENV": ""},
Copy link
Member

Choose a reason for hiding this comment

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

just discussion: this is a bit awkward, right? like there is some aspect of fixture tests (whatever is testing in_rp_fixture_test()) that should drive the name of this environment variable, rather than it being a "fixture test"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, personally I am not a fan of this method to toggle behavior deep in our crypto libraries. In terms of naming yeah this was just blanket added to every fixture test in CMake, and the crypto library does different stuff based on the variable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it becomes a misnomer this way. It'll probably be easier to rename it when cmake/ctest goes.

@bashtanov
Copy link
Contributor Author

test failure unrelated, https://redpandadata.atlassian.net/browse/CORE-8990 created

@bashtanov
Copy link
Contributor Author

/dt

1 similar comment
@bashtanov
Copy link
Contributor Author

/dt

We do not distinguish betwee unit and fixture tests in bazel, but
fixture tests need RP_FIXTURE_ENV=1 to make adjustments for running
multiple shards on the same thread. Add it for all tests by default, but
allow individual tests override it.
That's for testing harness to unset it by assigning a different value.
`ossl_context_service` only works if we have one seastar shard per
thread. RP_FIXTURE_ENV env variable disables the service to make it safe
to run multiple seastar shards in a single thread. A lot of tests need
this, so it is set by default. However, to test the service itself we
need to enable it.
@bashtanov
Copy link
Contributor Author

/dt

@bashtanov bashtanov requested a review from rockwotj February 5, 2025 22:55
@bashtanov bashtanov merged commit 3b4c77a into redpanda-data:dev Feb 6, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants