Skip to content

Commit 35a0685

Browse files
committed
Reflect the comments
Signed-off-by: Ingwon Song <[email protected]>
1 parent 25f6f58 commit 35a0685

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
$(bazel query 'kind(was.*_rust_binary, //test/test_data/...)')
5959
$(bazel query 'kind(_optimized_wasm_cc_binary, //test/test_data/...)')
6060
61-
# Currently, in Github Action, "Bazel build step" creates `wasm_configure_check.wasm` directory as a temporal directory.
61+
# Currently, in Github Action, "Bazel build step" creates `wasm_canary_check.wasm` directory as a temporal directory.
6262
# Since the name of this directory has "*.wasm" pattern, the step "Mangle build rules to use existing test data" fails.
6363
# So, here, we clear out the directories in test_data.
6464
- name: Clean up test data

test/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ cc_test(
9191
srcs = ["wasm_test.cc"],
9292
data = [
9393
"//test/test_data:abi_export.wasm",
94-
"//test/test_data:configure_check.wasm",
94+
"//test/test_data:canary_check.wasm",
9595
],
9696
linkstatic = 1,
9797
deps = [

test/test_data/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ wasm_rust_binary(
6262
)
6363

6464
proxy_wasm_cc_binary(
65-
name = "configure_check.wasm",
66-
srcs = ["configure_check.cc"],
65+
name = "canary_check.wasm",
66+
srcs = ["canary_check.cc"],
6767
)
File renamed without changes.

test/wasm_test.cc

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
#include "include/proxy-wasm/wasm.h"
1616

17-
#include "gtest/gtest.h"
1817
#include <unordered_set>
1918

19+
#include "gtest/gtest.h"
2020
#include "test/utility.h"
2121

2222
namespace proxy_wasm {
@@ -128,14 +128,6 @@ TEST_P(TestVm, AlwaysApplyCanary) {
128128
const auto fail_open = false;
129129

130130
// 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-
139131
auto canary_count = 0;
140132
WasmHandleCloneFactory wasm_handle_clone_factory_for_canary =
141133
[&canary_count, this](const std::shared_ptr<WasmHandleBase> &base_wasm_handle)
@@ -153,7 +145,7 @@ TEST_P(TestVm, AlwaysApplyCanary) {
153145
};
154146

155147
// Read the minimal loadable binary.
156-
auto source = readTestWasmFile("configure_check.wasm");
148+
auto source = readTestWasmFile("canary_check.wasm");
157149

158150
WasmHandleFactory wasm_handle_factory_baseline =
159151
[this, vm_ids, vm_configs](std::string_view vm_key) -> std::shared_ptr<WasmHandleBase> {
@@ -202,9 +194,11 @@ TEST_P(TestVm, AlwaysApplyCanary) {
202194
auto wasm_handle_comp =
203195
createWasm(vm_key, source, plugin_comp, wasm_handle_factory_comp,
204196
wasm_handle_clone_factory_for_canary, false);
197+
// For each create Wasm, canary should be done.
198+
EXPECT_EQ(canary_count, 1);
205199

206200
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
208202
// `plugin_config` is empty string.
209203
EXPECT_EQ(wasm_handle_comp, nullptr);
210204
continue;
@@ -233,8 +227,6 @@ TEST_P(TestVm, AlwaysApplyCanary) {
233227
} else {
234228
EXPECT_NE(plugin_baseline->key(), plugin_comp->key());
235229
}
236-
// For each create Wasm, canary should be done.
237-
EXPECT_EQ(canary_count, 1);
238230
}
239231
}
240232
}

0 commit comments

Comments
 (0)