cc640cddf7536b6ec773e77cf2d75d9429a5c8dc
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 v1"));
21 REQUIRE_THAT(output
, Contains("Usage:"));
22 REQUIRE_THAT(output
, Contains("Options:"));
23 REQUIRE_THAT(output
, Contains("-h|--help"));
24 REQUIRE_THAT(output
, Contains("-V|--version"));
25 REQUIRE_THAT(output
, Contains("--concurrency"));
26 REQUIRE_THAT(output
, Contains("Environment:"));
27 REQUIRE_THAT(output
, Contains("MEMCACHED_SERVERS"));
30 SECTION("with servers") {
31 auto test
= MemcachedCluster::udp();
32 auto flags
= {"--binary", "--udp", "--flush", "--test=mget", "--test=get", "--tcp-nodelay",
33 "--non-blocking", "--execute-number=1000"};
34 string servers
{"--servers="};
36 for (const auto &server
: test
.cluster
.getServers()) {
37 servers
+= "localhost:" + to_string(get
<int>(server
.getSocketOrPort())) + ", ";
40 for (const auto flag
: flags
) {
41 REQUIRE(sh
.run("memslap --quiet --concurrency=2 " + servers
+ flag
));