Skip to content

Commit

Permalink
fix so path
Browse files Browse the repository at this point in the history
Signed-off-by: doujiang24 <doujiang24@gmail.com>
  • Loading branch information
doujiang24 committed Jan 10, 2025
1 parent e8ae72c commit 16baf00
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions contrib/golang/filters/http/test/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ namespace HttpFilters {
namespace Golang {
namespace {

std::string genSoPath(std::string name) {
std::string genSoPath() {
return TestEnvironment::substitute(
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/" + name + "/filter.so");
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/plugins.so");
}

void cleanup() { Dso::DsoManager<Dso::HttpFilterDsoImpl>::cleanUpForTest(); }
Expand Down Expand Up @@ -55,7 +55,7 @@ TEST(GolangFilterConfigTest, GolangFilterWithValidConfig) {
)EOF";

const std::string PASSTHROUGH{"passthrough"};
auto yaml_string = absl::StrFormat(yaml_fmt, PASSTHROUGH, genSoPath(PASSTHROUGH));
auto yaml_string = absl::StrFormat(yaml_fmt, PASSTHROUGH, genSoPath());
envoy::extensions::filters::http::golang::v3alpha::Config proto_config;
TestUtility::loadFromYaml(yaml_string, proto_config);
NiceMock<Server::Configuration::MockFactoryContext> context;
Expand Down Expand Up @@ -84,7 +84,7 @@ TEST(GolangFilterConfigTest, GolangFilterWithNilPluginConfig) {
)EOF";

const std::string PASSTHROUGH{"passthrough"};
auto yaml_string = absl::StrFormat(yaml_fmt, PASSTHROUGH, genSoPath(PASSTHROUGH));
auto yaml_string = absl::StrFormat(yaml_fmt, PASSTHROUGH, genSoPath());
envoy::extensions::filters::http::golang::v3alpha::Config proto_config;
TestUtility::loadFromYaml(yaml_string, proto_config);
NiceMock<Server::Configuration::MockFactoryContext> context;
Expand Down
10 changes: 5 additions & 5 deletions contrib/golang/filters/http/test/golang_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class GolangHttpFilterTest : public testing::Test {
setupFilter(plugin_name);
}

std::string genSoPath(std::string name) {
std::string genSoPath() {
return TestEnvironment::substitute(
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/" + name + "/filter.so");
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/plugins.so");
}

void setupDso(std::string id, std::string path, std::string plugin_name) {
Expand Down Expand Up @@ -166,7 +166,7 @@ class GolangHttpFilterTest : public testing::Test {
// request that is headers only.
TEST_F(GolangHttpFilterTest, ScriptHeadersOnlyRequestHeadersOnly) {
InSequence s;
setup(PASSTHROUGH, genSoPath(PASSTHROUGH), PASSTHROUGH);
setup(PASSTHROUGH, genSoPath(), PASSTHROUGH);

Http::TestRequestHeaderMapImpl request_headers{{":path", "/"}};
EXPECT_EQ(Http::FilterHeadersStatus::Continue, filter_->decodeHeaders(request_headers, true));
Expand All @@ -176,7 +176,7 @@ TEST_F(GolangHttpFilterTest, ScriptHeadersOnlyRequestHeadersOnly) {
// setHeader at wrong stage
TEST_F(GolangHttpFilterTest, SetHeaderAtWrongStage) {
InSequence s;
setup(PASSTHROUGH, genSoPath(PASSTHROUGH), PASSTHROUGH);
setup(PASSTHROUGH, genSoPath(), PASSTHROUGH);
auto req = new HttpRequestInternal(*filter_);

EXPECT_EQ(CAPINotInGo, filter_->setHeader(req->decodingState(), "foo", "bar", HeaderSet));
Expand All @@ -187,7 +187,7 @@ TEST_F(GolangHttpFilterTest, SetHeaderAtWrongStage) {
// invalid config for routeconfig filter
TEST_F(GolangHttpFilterTest, InvalidConfigForRouteConfigFilter) {
InSequence s;
EXPECT_THROW_WITH_REGEX(setup(ROUTECONFIG, genSoPath(ROUTECONFIG), ROUTECONFIG), EnvoyException,
EXPECT_THROW_WITH_REGEX(setup(ROUTECONFIG, genSoPath(), ROUTECONFIG), EnvoyException,
"golang filter failed to parse plugin config");
}

Expand Down
16 changes: 8 additions & 8 deletions contrib/golang/filters/http/test/golang_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class GolangIntegrationTest : public testing::TestWithParam<Network::Address::Ip
addFakeUpstream(Http::CodecType::HTTP1);
}

std::string genSoPath(std::string name) {
std::string genSoPath() {
return TestEnvironment::substitute(
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/" + name + "/filter.so");
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/plugins.so");
}

void initializeConfig(const std::string& lib_id, const std::string& lib_path,
Expand Down Expand Up @@ -132,7 +132,7 @@ name: golang
set: foo
)EOF";

auto yaml_string = absl::StrFormat(yaml_fmt, so_id, genSoPath(so_id), so_id);
auto yaml_string = absl::StrFormat(yaml_fmt, so_id, genSoPath(), so_id);
config_helper_.prependFilter(yaml_string);
if (with_injected_metadata_validator) {
config_helper_.prependFilter("{ name: validate-dynamic-metadata }");
Expand Down Expand Up @@ -289,7 +289,7 @@ name: golang
)EOF";

auto so_id = ADDDATA;
auto yaml_string = absl::StrFormat(yaml_fmt, so_id, genSoPath(so_id), so_id);
auto yaml_string = absl::StrFormat(yaml_fmt, so_id, genSoPath(), so_id);
config_helper_.prependFilter(yaml_string);
config_helper_.skipPortUsageValidation();

Expand Down Expand Up @@ -817,7 +817,7 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, GolangIntegrationTest,
TestUtility::ipTestParamsToString);

TEST_P(GolangIntegrationTest, Echo) {
initializeConfig(ECHO, genSoPath(ECHO), ECHO);
initializeConfig(ECHO, genSoPath(), ECHO);
initialize();
registerTestServerPorts({"http"});

Expand All @@ -843,7 +843,7 @@ TEST_P(GolangIntegrationTest, Echo) {
}

TEST_P(GolangIntegrationTest, Passthrough) {
initializeConfig(PASSTHROUGH, genSoPath(PASSTHROUGH), PASSTHROUGH);
initializeConfig(PASSTHROUGH, genSoPath(), PASSTHROUGH);
initialize();
registerTestServerPorts({"http"});

Expand Down Expand Up @@ -880,7 +880,7 @@ TEST_P(GolangIntegrationTest, Passthrough) {
}

TEST_P(GolangIntegrationTest, PluginNotFound) {
initializeConfig(ECHO, genSoPath(ECHO), PASSTHROUGH);
initializeConfig(ECHO, genSoPath(), PASSTHROUGH);
initialize();
registerTestServerPorts({"http"});

Expand All @@ -904,7 +904,7 @@ TEST_P(GolangIntegrationTest, BufferResetAfterDrain) { testBufferApi("ResetAfter
TEST_P(GolangIntegrationTest, BufferLen) { testBufferApi("Len"); }

TEST_P(GolangIntegrationTest, Property) {
initializePropertyConfig(PROPERTY, genSoPath(PROPERTY), PROPERTY);
initializePropertyConfig(PROPERTY, genSoPath(), PROPERTY);
initialize();
registerTestServerPorts({"http"});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ ConfigHelper::HttpModifierFunction setRouteUsingWebsocket() {

void WebsocketIntegrationTest::initialize() { HttpProtocolIntegrationTest::initialize(); }

std::string genSoPath(std::string name) {
std::string genSoPath() {
return TestEnvironment::substitute(
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/" + name + "/filter.so");
"{{ test_rundir }}/contrib/golang/filters/http/test/test_data/plugins.so");
}

std::string filterConfig(const std::string& name) {
Expand All @@ -54,7 +54,7 @@ name: golang
match_path: "/echo"
)EOF";

return absl::StrFormat(yaml_fmt, name, genSoPath(name), name);
return absl::StrFormat(yaml_fmt, name, genSoPath(), name);
}

TEST_P(GolangWebsocketIntegrationTest, WebsocketGolangFilterChain) {
Expand Down

0 comments on commit 16baf00

Please sign in to comment.