1 #include "test/lib/common.hpp"
2 #include "test/lib/Shell.hpp"
3 #include "test/lib/MemcachedCluster.hpp"
7 using Catch::Matchers::Contains
;
9 TEST_CASE("bin/memaslap") {
10 Shell sh
{string
{TESTING_ROOT
"/../contrib/bin/memaslap"}};
12 SECTION("no servers provided") {
14 REQUIRE_FALSE(sh
.run("memaslap", output
));
15 REQUIRE_THAT(output
, Contains("No servers provided\n"));
21 REQUIRE(sh
.run("memaslap --help", output
));
22 REQUIRE_THAT(output
, Contains("memaslap"));
23 REQUIRE_THAT(output
, Contains("v1"));
25 REQUIRE_THAT(output, Contains("help"));
26 REQUIRE_THAT(output, Contains("version"));
27 REQUIRE_THAT(output, Contains("option"));
29 REQUIRE_THAT(output
, Contains("--"));
30 REQUIRE_THAT(output
, Contains("="));
33 SECTION("with servers") {
34 auto test
= MemcachedCluster::network();
36 " -T 2 -c 8 -t 2s -S 1s",
37 " -T 2 -c 8 -t 2s -v 0.2 -e 0.05 -b",
38 " -T 2 -c 8 -t 2s -w 40k -o 0.2",
39 " -T 2 -c 8 -t 2s -d 20 -P 40k",
41 " -T 2 -c 8 -t 2s -d 50 -a -n 10",
44 string servers
{"-s "};
46 for (const auto &server
: test
.cluster
.getServers()) {
47 servers
+= "127.0.0.1:" + to_string(get
<int>(server
.getSocketOrPort())) + ",";
49 for (const auto args
: examples
) {
52 auto ok
= sh
.run("memaslap -b " + servers
+ args
, output
);
55 REQUIRE_THAT(output
, Contains("TPS"));
59 #endif // HAVE_MEMASLAP