aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'config/src/tests')
-rw-r--r--config/src/tests/configagent/configagent.cpp20
-rw-r--r--config/src/tests/failover/failover.cpp2
-rw-r--r--config/src/tests/frt/frt.cpp22
-rw-r--r--config/src/tests/misc/misc.cpp27
-rw-r--r--config/src/tests/subscriber/subscriber.cpp2
5 files changed, 37 insertions, 36 deletions
diff --git a/config/src/tests/configagent/configagent.cpp b/config/src/tests/configagent/configagent.cpp
index d6766cce822..e4dc94fc2de 100644
--- a/config/src/tests/configagent/configagent.cpp
+++ b/config/src/tests/configagent/configagent.cpp
@@ -31,12 +31,12 @@ class MyConfigResponse : public ConfigResponse
{
public:
MyConfigResponse(const ConfigKey & key, const ConfigValue & value, bool valid, int64_t timestamp,
- const vespalib::string & md5, const std::string & errorMsg, int errorC0de, bool iserror)
+ const vespalib::string & xxhash64, const std::string & errorMsg, int errorC0de, bool iserror)
: _key(key),
_value(value),
_fillCalled(false),
_valid(valid),
- _state(md5, timestamp, false),
+ _state(xxhash64, timestamp, false),
_errorMessage(errorMsg),
_errorCode(errorC0de),
_isError(iserror)
@@ -64,9 +64,9 @@ public:
Trace _trace;
- static ConfigResponse::UP createOKResponse(const ConfigKey & key, const ConfigValue & value, uint64_t timestamp = 10, const vespalib::string & md5 = "a")
+ static ConfigResponse::UP createOKResponse(const ConfigKey & key, const ConfigValue & value, uint64_t timestamp = 10, const vespalib::string & xxhash64 = "a")
{
- return std::make_unique<MyConfigResponse>(key, value, true, timestamp, md5, "", 0, false);
+ return std::make_unique<MyConfigResponse>(key, value, true, timestamp, xxhash64, "", 0, false);
}
static ConfigResponse::UP createServerErrorResponse(const ConfigKey & key, const ConfigValue & value)
@@ -114,11 +114,11 @@ private:
};
-ConfigValue createValue(const std::string & myField, const std::string & md5)
+ConfigValue createValue(const std::string & myField, const std::string & xxhash64)
{
std::vector< vespalib::string > lines;
lines.push_back("myField \"" + myField + "\"");
- return ConfigValue(lines, md5);
+ return ConfigValue(lines, xxhash64);
}
static TimingValues testTimingValues(
@@ -139,7 +139,7 @@ TEST("require that agent returns correct values") {
ASSERT_EQUAL(500u, handler.getTimeout());
ASSERT_EQUAL(0u, handler.getWaitTime());
ConfigState cs;
- ASSERT_EQUAL(cs.md5, handler.getConfigState().md5);
+ ASSERT_EQUAL(cs.xxhash64, handler.getConfigState().xxhash64);
ASSERT_EQUAL(cs.generation, handler.getConfigState().generation);
ASSERT_EQUAL(cs.applyOnRestart, handler.getConfigState().applyOnRestart);
}
@@ -167,7 +167,7 @@ TEST("require that important(the change) request is delivered to holder even if
FRTConfigAgent handler(latch, testTimingValues);
handler.handleResponse(MyConfigRequest(testKey),
- MyConfigResponse::createOKResponse(testKey, testValue1, 1, testValue1.getMd5()));
+ MyConfigResponse::createOKResponse(testKey, testValue1, 1, testValue1.getXxhash64()));
ASSERT_TRUE(latch->poll());
ConfigUpdate::UP update(latch->provide());
ASSERT_TRUE(update);
@@ -176,9 +176,9 @@ TEST("require that important(the change) request is delivered to holder even if
ASSERT_EQUAL("l33t", cfg.myField);
handler.handleResponse(MyConfigRequest(testKey),
- MyConfigResponse::createOKResponse(testKey, testValue2, 2, testValue2.getMd5()));
+ MyConfigResponse::createOKResponse(testKey, testValue2, 2, testValue2.getXxhash64()));
handler.handleResponse(MyConfigRequest(testKey),
- MyConfigResponse::createOKResponse(testKey, testValue2, 3, testValue2.getMd5()));
+ MyConfigResponse::createOKResponse(testKey, testValue2, 3, testValue2.getXxhash64()));
ASSERT_TRUE(latch->poll());
update = latch->provide();
ASSERT_TRUE(update);
diff --git a/config/src/tests/failover/failover.cpp b/config/src/tests/failover/failover.cpp
index 2e039081716..cb8b7121b02 100644
--- a/config/src/tests/failover/failover.cpp
+++ b/config/src/tests/failover/failover.cpp
@@ -60,7 +60,7 @@ struct RPCServer : public FRT_Invokable {
info.setString("uncompressedSize", "0");
root.setString(RESPONSE_CONFIGID, "myId");
root.setString(RESPONSE_CLIENT_HOSTNAME, "myhost");
- root.setString(RESPONSE_CONFIG_MD5, "md5");
+ root.setString(RESPONSE_CONFIG_XXHASH64, "xxhash64");
root.setLong(RESPONSE_CONFIG_GENERATION, gen);
root.setObject(RESPONSE_TRACE);
Slime payload;
diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp
index cb09b8f7254..5af02f22ed2 100644
--- a/config/src/tests/frt/frt.cpp
+++ b/config/src/tests/frt/frt.cpp
@@ -72,7 +72,7 @@ namespace {
FRT_RPCRequest * createOKResponse(const vespalib::string & defName="",
const vespalib::string & defMd5="",
const vespalib::string & configId="",
- const vespalib::string & configMd5="",
+ const vespalib::string & configXxhash64="",
int changed=0,
long generation=0,
const std::vector<vespalib::string> & payload = std::vector<vespalib::string>(),
@@ -85,7 +85,7 @@ namespace {
ret.AddString("");
ret.AddString(defMd5.c_str());
ret.AddString(configId.c_str());
- ret.AddString(configMd5.c_str());
+ ret.AddString(configXxhash64.c_str());
ret.AddInt32(changed);
ret.AddInt64(generation);
FRT_StringValue * payload_arr = ret.AddStringArray(payload.size());
@@ -268,16 +268,16 @@ TEST_FF("require that request is config task is scheduled", SourceFixture(), FRT
TEST("require that v3 request is correctly initialized") {
ConnectionMock conn;
ConfigKey key = ConfigKey::create<MyConfig>("foobi");
- vespalib::string md5 = "mymd5";
+ vespalib::string xxhash64 = "myxxhash64";
int64_t currentGeneration = 3;
vespalib::string hostName = "myhost";
int64_t timeout = 3000;
Trace traceIn(3);
traceIn.trace(2, "Hei");
- FRTConfigRequestV3 v3req(&conn, key, md5, currentGeneration, hostName,
+ FRTConfigRequestV3 v3req(&conn, key, xxhash64, currentGeneration, hostName,
timeout, traceIn, VespaVersion::fromString("1.2.3"), CompressionType::LZ4);
- ASSERT_TRUE(v3req.verifyState(ConfigState(md5, 3, false)));
- ASSERT_FALSE(v3req.verifyState(ConfigState(md5, 2, false)));
+ ASSERT_TRUE(v3req.verifyState(ConfigState(xxhash64, 3, false)));
+ ASSERT_FALSE(v3req.verifyState(ConfigState(xxhash64, 2, false)));
ASSERT_FALSE(v3req.verifyState(ConfigState("xxx", 3, false)));
ASSERT_FALSE(v3req.verifyState(ConfigState("xxx", 2, false)));
@@ -297,7 +297,7 @@ TEST("require that v3 request is correctly initialized") {
EXPECT_EQUAL(key.getConfigId(), root[REQUEST_CLIENT_CONFIGID].asString().make_string());
EXPECT_EQUAL(hostName, root[REQUEST_CLIENT_HOSTNAME].asString().make_string());
EXPECT_EQUAL(currentGeneration, root[REQUEST_CURRENT_GENERATION].asLong());
- EXPECT_EQUAL(md5, root[REQUEST_CONFIG_MD5].asString().make_string());
+ EXPECT_EQUAL(xxhash64, root[REQUEST_CONFIG_XXHASH64].asString().make_string());
EXPECT_EQUAL(timeout, root[REQUEST_TIMEOUT].asLong());
EXPECT_EQUAL("LZ4", root[REQUEST_COMPRESSION_TYPE].asString().make_string());
EXPECT_EQUAL(root[REQUEST_VESPA_VERSION].asString().make_string(), "1.2.3");
@@ -322,7 +322,7 @@ struct V3RequestFixture {
Cursor & root;
FRT_RPCRequest * req;
ConfigKey key;
- vespalib::string md5;
+ vespalib::string xxhash64;
int64_t generation;
vespalib::string hostname;
Trace traceIn;
@@ -333,7 +333,7 @@ struct V3RequestFixture {
root(slime.setObject()),
req(conn.allocRPCRequest()),
key(ConfigKey::create<BarConfig>("foobi")),
- md5("mymd5"),
+ xxhash64("myxxhash64"),
generation(3),
hostname("myhhost"),
traceIn(3)
@@ -345,7 +345,7 @@ struct V3RequestFixture {
root.setString(RESPONSE_DEF_MD5, Memory(key.getDefMd5()));
root.setString(RESPONSE_CONFIGID, Memory(key.getConfigId()));
root.setString(RESPONSE_CLIENT_HOSTNAME, Memory(hostname));
- root.setString(RESPONSE_CONFIG_MD5, Memory(md5));
+ root.setString(RESPONSE_CONFIG_XXHASH64, Memory(xxhash64));
root.setLong(RESPONSE_CONFIG_GENERATION, generation);
traceIn.serialize(root.setObject(RESPONSE_TRACE));
}
@@ -379,7 +379,7 @@ struct V3RequestFixture {
EXPECT_EQUAL(key.getConfigId(), responseKey.getConfigId());
EXPECT_EQUAL(hostname, response.getHostName());
ConfigState state(response.getConfigState());
- EXPECT_EQUAL(md5, state.md5);
+ EXPECT_EQUAL(xxhash64, state.xxhash64);
EXPECT_EQUAL(generation, state.generation);
ConfigValue value(response.getValue());
BarConfig::UP config(value.newInstance<BarConfig>());
diff --git a/config/src/tests/misc/misc.cpp b/config/src/tests/misc/misc.cpp
index 1a8b8a59ede..55040242732 100644
--- a/config/src/tests/misc/misc.cpp
+++ b/config/src/tests/misc/misc.cpp
@@ -15,11 +15,11 @@ TEST("requireThatConfigUpdateWorks") {
std::vector<vespalib::string> lines;
lines.push_back("foo");
- ConfigUpdate up(ConfigValue(lines, "mymd5"), true, 1337);
+ ConfigUpdate up(ConfigValue(lines, "myxxhash"), true, 1337);
ASSERT_EQUAL(1337, up.getGeneration());
ASSERT_TRUE(up.hasChanged());
- ConfigUpdate up2(ConfigValue(lines, "mymd52"), false, 1338);
+ ConfigUpdate up2(ConfigValue(lines, "myxxhash2"), false, 1338);
ASSERT_EQUAL(1338, up2.getGeneration());
ASSERT_FALSE(up2.hasChanged());
}
@@ -27,22 +27,22 @@ TEST("requireThatConfigUpdateWorks") {
TEST("requireThatConfigValueWorks") {
std::vector<vespalib::string> lines;
lines.push_back("myFooField \"bar\"");
- ConfigValue v1(lines, calculateContentMd5(lines));
- ConfigValue v2(lines, calculateContentMd5(lines));
- ConfigValue v3(lines, calculateContentMd5(lines));
+ ConfigValue v1(lines, calculateContentXxhash64(lines));
+ ConfigValue v2(lines, calculateContentXxhash64(lines));
+ ConfigValue v3(lines, calculateContentXxhash64(lines));
lines.push_back("myFooField \"bar2\"");
- ConfigValue v4(lines, calculateContentMd5(lines));
+ ConfigValue v4(lines, calculateContentXxhash64(lines));
ASSERT_TRUE(v1 == v2);
ASSERT_TRUE(v1 == v3);
}
TEST("requireThatConfigKeyWorks") {
- ConfigKey key1("id1", "def1", "namespace1", "md51");
- ConfigKey key2("id1", "def1", "namespace1", "md51");
- ConfigKey key3("id2", "def1", "namespace1", "md51");
- ConfigKey key4("id1", "def2", "namespace1", "md51");
- ConfigKey key5("id1", "def1", "namespace2", "md51");
- ConfigKey key6("id1", "def1", "namespace1", "md52"); // Special case. Md5 does not matter, so should be qual to key1 and key2
+ ConfigKey key1("id1", "def1", "namespace1", "xxhash1");
+ ConfigKey key2("id1", "def1", "namespace1", "xxhash1");
+ ConfigKey key3("id2", "def1", "namespace1", "xxhash1");
+ ConfigKey key4("id1", "def2", "namespace1", "xxhash1");
+ ConfigKey key5("id1", "def1", "namespace2", "xxhash1");
+ ConfigKey key6("id1", "def1", "namespace1", "xxhash2"); // Special case. xxhash64 does not matter, so should be qual to key1 and key2
ASSERT_TRUE(key1 == key2);
@@ -111,7 +111,7 @@ TEST("require that config key initializes schema")
std::vector<vespalib::string> schema;
schema.push_back("foo");
schema.push_back("bar");
- ConfigKey key("id1", "def1", "namespace1", "md51", schema);
+ ConfigKey key("id1", "def1", "namespace1", "xxhash1", schema);
const std::vector<vespalib::string> &vref(key.getDefSchema());
for (size_t i = 0; i < schema.size(); i++) {
ASSERT_EQUAL(schema[i], vref[i]);
@@ -131,6 +131,7 @@ TEST("require that error codes are correctly translated to strings") {
ASSERT_CONFIG(ILLEGAL_CONFIGID);
ASSERT_CONFIG(ILLEGAL_DEF_MD5);
ASSERT_CONFIG(ILLEGAL_CONFIG_MD5);
+ ASSERT_CONFIG(ILLEGAL_CONFIG_MD5);
ASSERT_CONFIG(ILLEGAL_TIMEOUT);
ASSERT_CONFIG(ILLEGAL_TIMESTAMP);
ASSERT_CONFIG(ILLEGAL_NAME_SPACE);
diff --git a/config/src/tests/subscriber/subscriber.cpp b/config/src/tests/subscriber/subscriber.cpp
index d58699f26e0..5c5714a867a 100644
--- a/config/src/tests/subscriber/subscriber.cpp
+++ b/config/src/tests/subscriber/subscriber.cpp
@@ -20,7 +20,7 @@ namespace {
{
std::vector< vespalib::string > lines;
lines.push_back(value);
- return ConfigValue(lines, calculateContentMd5(lines));
+ return ConfigValue(lines, calculateContentXxhash64(lines));
}
ConfigValue createFooValue(const std::string & value)