Skip to content

Commit a81c6f8

Browse files
committed
Fixes
Signed-off-by: Rohit Agrawal <[email protected]>
1 parent 6a76942 commit a81c6f8

File tree

8 files changed

+12
-420
lines changed

8 files changed

+12
-420
lines changed

source/extensions/dynamic_modules/abi_version.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
#pragma once
2-
32
#ifdef __cplusplus
4-
extern "C" {
3+
namespace Envoy {
4+
namespace Extensions {
5+
namespace DynamicModules {
56
#endif
6-
77
// This is the ABI version calculated as a sha256 hash of the ABI header files. When the ABI
88
// changes, this value must change, and the correctness of this value is checked by the test.
99
const char* kAbiVersion = "671102aad648320f21c53d1c04aa9780d1d2668e3e63e8a993d30a9029a168e4";
1010

1111
#ifdef __cplusplus
12-
} // extern "C"
13-
14-
namespace Envoy {
15-
namespace Extensions {
16-
namespace DynamicModules {
17-
namespace AbiVersion {
18-
// For C++ code, also provide the version in the namespace.
19-
constexpr const char kAbiVersion[] =
20-
"671102aad648320f21c53d1c04aa9780d1d2668e3e63e8a993d30a9029a168e4";
21-
} // namespace AbiVersion
2212
} // namespace DynamicModules
2313
} // namespace Extensions
2414
} // namespace Envoy

source/extensions/dynamic_modules/dynamic_modules.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ newDynamicModule(const std::filesystem::path& object_file_absolute_path, const b
6565
absl::StrCat("Failed to initialize dynamic module: ", object_file_absolute_path.c_str()));
6666
}
6767
// Checks the kAbiVersion and the version of the dynamic module.
68-
if (absl::string_view(abi_version) != absl::string_view(AbiVersion::kAbiVersion)) {
69-
return absl::InvalidArgumentError(absl::StrCat("ABI version mismatch: got ", abi_version,
70-
", but expected ", AbiVersion::kAbiVersion));
68+
if (absl::string_view(abi_version) != absl::string_view(kAbiVersion)) {
69+
return absl::InvalidArgumentError(
70+
absl::StrCat("ABI version mismatch: got ", abi_version, ", but expected ", kAbiVersion));
7171
}
7272
return dynamic_module;
7373
}

source/extensions/dynamic_modules/sdk/rust/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ fn main() {
1818
println!("cargo:rerun-if-changed=abi.h");
1919
let bindings = bindgen::Builder::default()
2020
.header("../../abi.h")
21+
.header("../../abi_version.h")
2122
.clang_arg("-v")
2223
.default_enum_style(bindgen::EnumVariation::Rust {
2324
non_exhaustive: false,

source/extensions/dynamic_modules/sdk/rust/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ use std::sync::OnceLock;
2121
/// This is not meant to be used directly.
2222
pub mod abi {
2323
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
24-
25-
/// ABI version string. This must match the kAbiVersion in abi_version.h.
26-
/// The version is the SHA256 hash of the abi.h file.
27-
pub const kAbiVersion: &[u8] =
28-
b"671102aad648320f21c53d1c04aa9780d1d2668e3e63e8a993d30a9029a168e4\0";
2924
}
3025

3126
/// Declare the init functions for the dynamic module.

test/coverage.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ directories:
4040
source/extensions/filters/common/lua: 95.6
4141
source/extensions/filters/http/cache: 95.9
4242
source/extensions/filters/http/dynamic_forward_proxy: 94.8
43+
source/extensions/filters/http/dynamic_modules: 95.6
4344
source/extensions/filters/http/decompressor: 95.9
4445
source/extensions/filters/http/ext_proc: 96.4 # might be flaky: be careful adjusting
4546
source/extensions/filters/http/grpc_json_reverse_transcoder: 94.8

test/extensions/dynamic_modules/http/abi_impl_test.cc

Lines changed: 0 additions & 395 deletions
Large diffs are not rendered by default.

test/extensions/dynamic_modules/http/integration_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ TEST_P(DynamicModulesTerminalIntegrationTest, StreamingTerminalFilter) {
713713
EXPECT_EQ(below_watermark_count, 8);
714714
}
715715

716-
// Test basic HTTP stream callout - GET request with streaming response.
716+
// Test basic HTTP stream callout. A GET request with streaming response.
717717
TEST_P(DynamicModulesIntegrationTest, HttpStreamBasic) {
718718
initializeFilter("http_stream_basic", "cluster_0");
719719
codec_client_ = makeHttpConnection(makeClientConnection((lookupPort("http"))));
@@ -738,7 +738,7 @@ TEST_P(DynamicModulesIntegrationTest, HttpStreamBasic) {
738738
response->headers().get(Http::LowerCaseString("x-stream-test"))[0]->value().getStringView());
739739
}
740740

741-
// Test bidirectional HTTP stream callout - POST with streaming request and response.
741+
// Test bidirectional HTTP stream callout. A POST request with streaming request and response.
742742
TEST_P(DynamicModulesIntegrationTest, HttpStreamBidirectional) {
743743
initializeFilter("http_stream_bidirectional", "cluster_0");
744744
codec_client_ = makeHttpConnection(makeClientConnection((lookupPort("http"))));

test/extensions/dynamic_modules/test_data/rust/http_integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ impl StreamingTerminalHttpFilter {
12051205
// HTTP Stream Callouts Tests
12061206
// =============================================================================
12071207

1208-
// Basic HTTP Stream Test - simple GET request with streaming response.
1208+
// Basic HTTP Stream Test. A simple GET request with streaming response.
12091209
struct HttpStreamBasicConfig {
12101210
cluster_name: String,
12111211
}
@@ -1320,7 +1320,7 @@ impl Drop for HttpStreamBasicFilter {
13201320
}
13211321
}
13221322

1323-
// Bidirectional HTTP Stream Test - POST with streaming request and response.
1323+
// Bidirectional HTTP Stream Test. A POST request with streaming request and response.
13241324
struct HttpStreamBidirectionalConfig {
13251325
cluster_name: String,
13261326
}

0 commit comments

Comments
 (0)