1 #include "test/lib/common.hpp"
2 #include "test/lib/Shell.hpp"
3 #include "test/lib/MemcachedCluster.hpp"
5 using Catch::Matchers::Contains
;
7 TEST_CASE("bin/memslap") {
8 Shell sh
{string
{TESTING_ROOT
"/../src/bin"}};
10 SECTION("no servers provided") {
12 REQUIRE_FALSE(sh
.run("memslap", output
));
13 REQUIRE(output
== "No servers provided\n");
19 REQUIRE(sh
.run("memslap --help", output
));
20 REQUIRE_THAT(output
, Contains("memslap"));
21 REQUIRE_THAT(output
, Contains("v1"));
22 REQUIRE_THAT(output
, Contains("help"));
23 REQUIRE_THAT(output
, Contains("version"));
24 REQUIRE_THAT(output
, Contains("option"));
25 REQUIRE_THAT(output
, Contains("--"));
26 REQUIRE_THAT(output
, Contains("="));
29 SECTION("with servers") {
30 auto test
= MemcachedCluster::udp();
31 auto flags
= {"--binary", "--udp", "--flush", "--test=mget", "--test=get", "--tcp-nodelay",
32 "--non-blocking", "--initial-load=1000"};
33 string servers
{"--servers="};
35 for (const auto &server
: test
.cluster
.getServers()) {
36 servers
+= "localhost:" + to_string(get
<int>(server
.getSocketOrPort())) + ", ";
39 for (const auto flag
: flags
) {
40 REQUIRE(sh
.run("memslap --quiet --concurrency=2 " + servers
+ flag
));