-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: enable/disable internet-dependent tests at runtime #2683
base: master
Are you sure you want to change the base?
Conversation
…ng conflicts Previously, we had two variants of test_simple_x509_client - one testing with Google servers and another with a local server. These variants were conditionally compiled using `#if SEASTAR_TESTING_WITH_NETWORKING` and `#if !SEASTAR_TESTING_WITH_NETWORKING` macros respectively, ensuring only be compiled based on networking availability. In an upcoming change, we'll replace these compile-time conditionals with boost decorators to dynamically enable/disable tests at runtime based on the same `SEASTAR_TESTING_WITH_NETWORKING` macro. This will result in both test variants being compiled simultaneously, causing naming conflicts. This commit renames the test variants with distinct names to prepare for the upcoming consolidation of network access testing. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
Previously, some tests in dns_test.cc and tls_test.cc that required internet connectivity were conditionally compiled using `#if SEASTAR_TESTING_WITH_NETWORKING`. However, several other internet-dependent tests were not properly disabled, causing test failures in environments without internet access. This change: - Replaces compile-time guards with runtime conditional execution using boost::unit_test::enable_if<SEASTAR_TESTING_WITH_NETWORKING> for tests requiring internet - Uses boost::unit_test::enable_if<!SEASTAR_TESTING_WITH_NETWORKING> for alternative tests that provide equivalent coverage without internet access This approach improves maintainability, enables running the test suite in offline environments, and makes internet dependencies more explicit in the test code. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
cc @Comrade88 |
now you reapeat these typedef's in every test file. may be it is better to put them somewhere central or even introduce special SEASTAR_TEST_CASE macro wrappers? |
so far, we have two test files including this decorator. once it repeats itself in more places, probably we should indeed have a central place for it. what do you think? |
at the moment before my pr there was only one place in the project with a conditional disabling of online tests. I encountered a problem, found this place, understood what needed to be changed, and decided that this is how such issues are solved here. |
Previously, some tests in dns_test.cc and tls_test.cc that required internet connectivity were conditionally compiled using
#if SEASTAR_TESTING_WITH_NETWORKING
. However, several other internet-dependent tests were not properly disabled,causing test failures in environments without internet access.
This change:
boost::unit_test::enable_if<SEASTAR_TESTING_WITH_NETWORKING>
for tests requiring internetboost::unit_test::enable_if<!SEASTAR_TESTING_WITH_NETWORKING>
for alternative tests that provide equivalent coverage without internet accessThis approach improves maintainability, enables running the test suite in offline environments, and makes internet dependencies more explicit in the test code.