Skip to content

Commit bbcd2d0

Browse files
author
Pete Stevenson
authored
[stirling] Fix netty_tls_trace_bpf_test.cc mux protocol tracing option. (#1690)
Summary: To prevent older kernels from complaining about eBPF instruction count, mux protocol tracing is only enabled for "newer" kernels. In our test case, we want to enable mux tracing. We fix test `netty_tls_trace_bpf_test.cc` by enabling mux protocol tracing using the test `SetUp` method (and we simultaneously disable a few other protocols to save on eBPF instruction count). Previously, we used an init function, but that was rendered ineffective after we switched our flags from command line args. to env. args. Type of change: /kind bug fix Test Plan: Existing tests. Signed-off-by: Pete Stevenson <jps@pixielabs.ai>
1 parent 9a4ad3c commit bbcd2d0

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/stirling/source_connectors/socket_tracer/netty_tls_trace_bpf_test.cc

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,27 @@ using ::testing::UnorderedElementsAre;
5050

5151
class ThriftMuxServerContainerWrapper : public ::px::stirling::testing::ThriftMuxServerContainer {};
5252

53-
// The Init() function is used to set flags for the entire test.
54-
// We can't do this in the MuxTraceTest constructor, because it will be too late
55-
// (SocketTraceBPFTestFixture will already have been constructed).
56-
bool Init() {
57-
// Make sure Mux tracing is enabled.
58-
FLAGS_stirling_enable_mux_tracing = true;
59-
60-
// We turn off CQL and NATS tracing to give some BPF instructions back for Mux.
61-
// This is required for older kernels with only 4096 BPF instructions.
62-
FLAGS_stirling_enable_cass_tracing = false;
63-
FLAGS_stirling_enable_nats_tracing = false;
64-
65-
// Enable the raw fptr fallback for determining ssl lib version.
66-
FLAGS_openssl_raw_fptrs_enabled = true;
67-
return true;
53+
namespace {
54+
constexpr bool kClientSideTracing = false;
6855
}
6956

70-
bool kInit = Init();
71-
7257
template <typename TServerContainer>
73-
class BaseOpenSSLTraceTest : public SocketTraceBPFTestFixture</* TClientSideTracing */ false> {
58+
class BaseOpenSSLTraceTest : public SocketTraceBPFTestFixture<kClientSideTracing> {
7459
protected:
60+
void SetUp() override {
61+
PX_SET_FOR_SCOPE(FLAGS_stirling_enable_mux_tracing, true);
62+
63+
// We turn off CQL and NATS tracing to give some BPF instructions back for Mux.
64+
// This is required for older kernels with only 4096 BPF instructions.
65+
PX_SET_FOR_SCOPE(FLAGS_stirling_enable_cass_tracing, false);
66+
PX_SET_FOR_SCOPE(FLAGS_stirling_enable_nats_tracing, false);
67+
68+
// Enable the raw fptr fallback for determining ssl lib version.
69+
PX_SET_FOR_SCOPE(FLAGS_openssl_raw_fptrs_enabled, true);
70+
71+
SocketTraceBPFTestFixture<kClientSideTracing>::SetUp();
72+
}
73+
7574
BaseOpenSSLTraceTest() {
7675
// Run the nginx HTTPS server.
7776
// The container runner will make sure it is in the ready state before unblocking.

0 commit comments

Comments
 (0)