14
14
15
15
#include " include/proxy-wasm/wasm.h"
16
16
17
- #include " gtest/gtest.h"
18
17
#include < unordered_set>
19
18
19
+ #include " gtest/gtest.h"
20
20
#include " test/utility.h"
21
21
22
22
namespace proxy_wasm {
@@ -128,14 +128,6 @@ TEST_P(TestVm, AlwaysApplyCanary) {
128
128
const auto fail_open = false ;
129
129
130
130
// Define common callbacks
131
- WasmHandleCloneFactory wasm_handle_clone_factory =
132
- [this ](const std::shared_ptr<WasmHandleBase> &base_wasm_handle)
133
- -> std::shared_ptr<WasmHandleBase> {
134
- auto wasm = std::make_shared<TestWasm>(base_wasm_handle,
135
- [this ]() -> std::unique_ptr<WasmVm> { return newVm (); });
136
- return std::make_shared<WasmHandleBase>(wasm);
137
- };
138
-
139
131
auto canary_count = 0 ;
140
132
WasmHandleCloneFactory wasm_handle_clone_factory_for_canary =
141
133
[&canary_count, this ](const std::shared_ptr<WasmHandleBase> &base_wasm_handle)
@@ -153,7 +145,7 @@ TEST_P(TestVm, AlwaysApplyCanary) {
153
145
};
154
146
155
147
// Read the minimal loadable binary.
156
- auto source = readTestWasmFile (" configure_check .wasm" );
148
+ auto source = readTestWasmFile (" canary_check .wasm" );
157
149
158
150
WasmHandleFactory wasm_handle_factory_baseline =
159
151
[this , vm_ids, vm_configs](std::string_view vm_key) -> std::shared_ptr<WasmHandleBase> {
@@ -202,9 +194,11 @@ TEST_P(TestVm, AlwaysApplyCanary) {
202
194
auto wasm_handle_comp =
203
195
createWasm (vm_key, source, plugin_comp, wasm_handle_factory_comp,
204
196
wasm_handle_clone_factory_for_canary, false );
197
+ // For each create Wasm, canary should be done.
198
+ EXPECT_EQ (canary_count, 1 );
205
199
206
200
if (plugin_config.empty ()) {
207
- // configure_check .wasm should raise the error at `onConfigure` in canary when the
201
+ // canary_check .wasm should raise the error at `onConfigure` in canary when the
208
202
// `plugin_config` is empty string.
209
203
EXPECT_EQ (wasm_handle_comp, nullptr );
210
204
continue ;
@@ -233,8 +227,6 @@ TEST_P(TestVm, AlwaysApplyCanary) {
233
227
} else {
234
228
EXPECT_NE (plugin_baseline->key (), plugin_comp->key ());
235
229
}
236
- // For each create Wasm, canary should be done.
237
- EXPECT_EQ (canary_count, 1 );
238
230
}
239
231
}
240
232
}
0 commit comments