Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions proxy/http/remap/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ test_RemapPluginInfo_SOURCES = \
test_NextHopStrategyFactory_CPPFLAGS = \
$(AM_CPPFLAGS) \
-D_NH_UNIT_TESTS_ \
-DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
-I$(abs_top_srcdir)/tests/include \
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@
Expand Down Expand Up @@ -154,6 +155,7 @@ test_NextHopStrategyFactory_SOURCES = \
test_NextHopRoundRobin_CPPFLAGS = \
$(AM_CPPFLAGS) \
-D_NH_UNIT_TESTS_ \
-DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
-I$(abs_top_srcdir)/tests/include \
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@
Expand Down Expand Up @@ -183,6 +185,7 @@ test_NextHopRoundRobin_SOURCES = \
test_NextHopConsistentHash_CPPFLAGS = \
$(AM_CPPFLAGS) \
-D_NH_UNIT_TESTS_ \
-DTS_SRC_DIR=\"$(abs_top_srcdir)/proxy/http/remap/\" \
-I$(abs_top_srcdir)/tests/include \
$(TS_INCLUDES) \
@YAMLCPP_INCLUDES@
Expand Down
6 changes: 3 additions & 3 deletions proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ SCENARIO("Testing NextHopConsistentHash class, using policy 'consistent_hash'",
{
// load the configuration strtegies.
std::shared_ptr<NextHopSelectionStrategy> strategy;
NextHopStrategyFactory nhf("unit-tests/consistent-hash-tests.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml");
strategy = nhf.strategyInstance("consistent-hash-1");

WHEN("the config is loaded.")
Expand Down Expand Up @@ -187,7 +187,7 @@ SCENARIO("Testing NextHopConsistentHash class (all firstcalls), using policy 'co
GIVEN("Loading the consistent-hash-tests.yaml config for 'consistent_hash' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
NextHopStrategyFactory nhf("unit-tests/consistent-hash-tests.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml");
strategy = nhf.strategyInstance("consistent-hash-1");

WHEN("the config is loaded.")
Expand Down Expand Up @@ -286,7 +286,7 @@ SCENARIO("Testing NextHopConsistentHash class (alternating rings), using policy
GIVEN("Loading the consistent-hash-tests.yaml config for 'consistent_hash' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
NextHopStrategyFactory nhf("unit-tests/consistent-hash-tests.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml");
strategy = nhf.strategyInstance("consistent-hash-2");

WHEN("the config is loaded.")
Expand Down
8 changes: 4 additions & 4 deletions proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'rr-strict'", "[NextHopR
GIVEN("Loading the round-robin-tests.yaml config for round robin 'rr-strict' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("rr-strict-exhaust-ring");

WHEN("the config is loaded.")
Expand Down Expand Up @@ -143,7 +143,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'first-live'", "[NextHop
GIVEN("Loading the round-robin-tests.yaml config for round robin 'first-live' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("first-live");

WHEN("the config is loaded.")
Expand Down Expand Up @@ -199,7 +199,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'rr-ip'", "[NextHopRound
GIVEN("Loading the round-robin-tests.yaml config for round robin 'rr-ip' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("rr-ip");
sockaddr_in sa1, sa2;
sa1.sin_port = 10000;
Expand Down Expand Up @@ -257,7 +257,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'latched'", "[NextHopRou
GIVEN("Loading the round-robin-tests.yaml config for round robin 'latched' tests.")
{
std::shared_ptr<NextHopSelectionStrategy> strategy;
NextHopStrategyFactory nhf("unit-tests/round-robin-tests.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml");
strategy = nhf.strategyInstance("latched");

WHEN("the config is loaded.")
Expand Down
11 changes: 7 additions & 4 deletions proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]")
{
GIVEN("Loading the strategy.yaml with included 'hosts.yaml'.")
{
NextHopStrategyFactory nhf("unit-tests/strategy.yaml");
#ifdef TS_SRC_DIR
REQUIRE(chdir(TS_SRC_DIR) == 0);
#endif
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/strategy.yaml");

WHEN("the two files are loaded.")
{
Expand Down Expand Up @@ -216,7 +219,7 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]")

GIVEN("loading a yaml config, simple-strategy.yaml ")
{
NextHopStrategyFactory nhf("unit-tests/simple-strategy.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/simple-strategy.yaml");

WHEN("loading the single file")
{
Expand Down Expand Up @@ -357,7 +360,7 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]")

GIVEN("loading a yaml config combining hosts and strategies into one file, combined.yaml")
{
NextHopStrategyFactory nhf("unit-tests/combined.yaml");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/combined.yaml");

WHEN("loading the single file")
{
Expand Down Expand Up @@ -779,7 +782,7 @@ SCENARIO("factory tests loading yaml configs from a directory", "[loadConfig]")
{
GIVEN("Loading the strategies using a directory of 'yaml' files")
{
NextHopStrategyFactory nhf("unit-tests/strategies-dir");
NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/strategies-dir");

WHEN("the two files are loaded.")
{
Expand Down