Skip to content

Commit d88a602

Browse files
committed
fix test
Signed-off-by: Kuat Yessenov <[email protected]>
1 parent 57f0583 commit d88a602

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

test/wasm_test.cc

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ TEST_P(TestVm, AlwaysApplyCanary) {
171171
// For each create Wasm, canary should be done.
172172
EXPECT_EQ(canary_count, 1);
173173

174+
bool first = true;
174175
std::unordered_set<std::shared_ptr<WasmHandleBase>> reference_holder;
175176

176177
for (const auto &root_id : root_ids) {
@@ -195,6 +196,13 @@ TEST_P(TestVm, AlwaysApplyCanary) {
195196
auto wasm_handle_comp =
196197
createWasm(vm_key, source, plugin_comp, wasm_handle_factory_comp,
197198
wasm_handle_clone_factory_for_canary, false);
199+
// Validate that canarying is cached for the first variant.
200+
if (first) {
201+
first = false;
202+
EXPECT_EQ(canary_count, 0);
203+
continue;
204+
}
205+
198206
// For each create Wasm, canary should be done.
199207
EXPECT_EQ(canary_count, 1);
200208

@@ -233,30 +241,6 @@ TEST_P(TestVm, AlwaysApplyCanary) {
233241
}
234242
}
235243
}
236-
237-
{
238-
// Validate that canarying is cached
239-
canary_count = 0;
240-
TestContext::resetGlobalLog();
241-
const auto &root_id = root_ids[0];
242-
const auto &vm_id = vm_ids[0];
243-
const auto &vm_config = vm_configs[0];
244-
const auto &plugin_key = plugin_keys[0];
245-
const auto &plugin_config = plugin_configs[0];
246-
WasmHandleFactory wasm_handle_factory_comp =
247-
[this, vm_id, vm_config](std::string_view vm_key) -> std::shared_ptr<WasmHandleBase> {
248-
auto base_wasm = std::make_shared<TestWasm>(
249-
newVm(), std::unordered_map<std::string, std::string>(), vm_id, vm_config, vm_key);
250-
return std::make_shared<WasmHandleBase>(base_wasm);
251-
};
252-
const auto plugin_comp = std::make_shared<PluginBase>(plugin_name, root_id, vm_id, engine_,
253-
plugin_config, fail_open, plugin_key);
254-
const auto vm_key = makeVmKey(vm_id, vm_config, "common_code");
255-
// Create a base Wasm by createWasm.
256-
auto wasm_handle_comp = createWasm(vm_key, source, plugin_comp, wasm_handle_factory_comp,
257-
wasm_handle_clone_factory_for_canary, false);
258-
EXPECT_EQ(canary_count, 0);
259-
}
260244
}
261245

262246
} // namespace proxy_wasm

0 commit comments

Comments
 (0)