aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@vespa.ai>2024-05-16 12:57:07 +0000
committerTor Brede Vekterli <vekterli@vespa.ai>2024-05-16 12:57:07 +0000
commitb377a3c28efec6dae55a33cea1e536cc8b7117e7 (patch)
treea7b7d16233375ba3961c7a04faab059ead4e892e
parent9a3ef654bfe4dda2a3c0d74928a29d8e75e35ae9 (diff)
Remove vdstestlib module
Was only used by `DirConfig`.
-rw-r--r--CMakeLists.txt1
-rw-r--r--metrics/src/tests/CMakeLists.txt1
-rw-r--r--searchcore/src/apps/tests/CMakeLists.txt1
-rw-r--r--storage/CMakeLists.txt1
-rw-r--r--storage/src/tests/common/CMakeLists.txt1
-rw-r--r--storage/src/tests/common/testhelper.cpp129
-rw-r--r--storage/src/tests/common/testhelper.h28
-rw-r--r--storageserver/src/tests/CMakeLists.txt2
-rw-r--r--storageserver/src/tests/storageservertest.cpp4
-rw-r--r--storageserver/src/tests/testhelper.cpp118
-rw-r--r--storageserver/src/tests/testhelper.h24
-rw-r--r--vdslib/CMakeLists.txt3
-rw-r--r--vdstestlib/.gitignore1
-rw-r--r--vdstestlib/CMakeLists.txt12
-rw-r--r--vdstestlib/OWNERS1
-rw-r--r--vdstestlib/src/.gitignore3
-rw-r--r--vdstestlib/src/tests/dirconfig/.gitignore5
-rw-r--r--vdstestlib/src/tests/dirconfig/CMakeLists.txt8
-rw-r--r--vdstestlib/src/tests/dirconfig/dirconfigtest.cpp106
-rw-r--r--vdstestlib/src/vespa/vdstestlib/.gitignore3
-rw-r--r--vdstestlib/src/vespa/vdstestlib/CMakeLists.txt6
-rw-r--r--vdstestlib/src/vespa/vdstestlib/config/.gitignore3
-rw-r--r--vdstestlib/src/vespa/vdstestlib/config/CMakeLists.txt6
-rw-r--r--vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp206
-rw-r--r--vdstestlib/src/vespa/vdstestlib/config/dirconfig.h77
-rw-r--r--vdstestlib/src/vespa/vdstestlib/config/dirconfig.hpp30
-rw-r--r--vdstestlib/testrun/.gitignore19
27 files changed, 4 insertions, 795 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c353863053..919a8d71669 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -172,7 +172,6 @@ add_subdirectory(streamingvisitors)
add_subdirectory(tenant-cd-api)
add_subdirectory(vbench)
add_subdirectory(vdslib)
-add_subdirectory(vdstestlib)
add_subdirectory(vespa-3party-bundles)
add_subdirectory(vespa-3party-jars)
add_subdirectory(vespa-athenz)
diff --git a/metrics/src/tests/CMakeLists.txt b/metrics/src/tests/CMakeLists.txt
index 779b799cc75..d46ff6ff0dd 100644
--- a/metrics/src/tests/CMakeLists.txt
+++ b/metrics/src/tests/CMakeLists.txt
@@ -14,7 +14,6 @@ vespa_add_executable(metrics_gtest_runner_app TEST
gtest_runner.cpp
DEPENDS
metrics
- vdstestlib
GTest::GTest
)
diff --git a/searchcore/src/apps/tests/CMakeLists.txt b/searchcore/src/apps/tests/CMakeLists.txt
index 21df1f01dc3..80fcde9d337 100644
--- a/searchcore/src/apps/tests/CMakeLists.txt
+++ b/searchcore/src/apps/tests/CMakeLists.txt
@@ -19,6 +19,5 @@ vespa_add_executable(searchcore_persistenceconformance_test_app TEST
searchcore_pcommon
searchcore_grouping
searchcore_proton_metrics
- vdstestlib
persistence_persistence_conformancetest
)
diff --git a/storage/CMakeLists.txt b/storage/CMakeLists.txt
index eeec705b13f..c59d095fb4c 100644
--- a/storage/CMakeLists.txt
+++ b/storage/CMakeLists.txt
@@ -54,7 +54,6 @@ vespa_define_module(
TEST_DEPENDS
messagebus_messagebus-test
- vdstestlib
TEST_EXTERNAL_DEPENDS
${VESPA_ATOMIC_LIB}
diff --git a/storage/src/tests/common/CMakeLists.txt b/storage/src/tests/common/CMakeLists.txt
index 14cb510499f..0e075e39194 100644
--- a/storage/src/tests/common/CMakeLists.txt
+++ b/storage/src/tests/common/CMakeLists.txt
@@ -4,7 +4,6 @@ vespa_add_library(storage_testcommon TEST
dummystoragelink.cpp
message_sender_stub.cpp
storage_config_set.cpp
- testhelper.cpp
testnodestateupdater.cpp
teststorageapp.cpp
DEPENDS
diff --git a/storage/src/tests/common/testhelper.cpp b/storage/src/tests/common/testhelper.cpp
deleted file mode 100644
index 91758b894b0..00000000000
--- a/storage/src/tests/common/testhelper.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <tests/common/testhelper.h>
-
-#include <vespa/log/log.h>
-#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/vespalib/testkit/test_kit.h>
-
-LOG_SETUP(".testhelper");
-
-namespace storage {
-
-void addStorageDistributionConfig(vdstestlib::DirConfig& dc)
-{
- vdstestlib::DirConfig::Config* config;
- config = &dc.getConfig("stor-distribution", true);
- config->clear();
- config->set("group[1]");
- config->set("group[0].name", "invalid");
- config->set("group[0].index", "invalid");
- config->set("group[0].nodes[50]");
- config->set("redundancy", "2");
-
- for (uint32_t i = 0; i < 50; i++) {
- std::ostringstream key; key << "group[0].nodes[" << i << "].index";
- std::ostringstream val; val << i;
- config->set(key.str(), val.str());
- }
-}
-
-std::string getRootFolder(vdstestlib::DirConfig & dc) {
- std::string defaultValue("");
- return dc.getConfig("stor-server").getValue("root_folder", defaultValue);
-}
-
-vdstestlib::DirConfig getStandardConfig(bool storagenode, const std::string & rootOfRoot) {
- std::string clusterName("storage");
- vdstestlib::DirConfig dc;
- vdstestlib::DirConfig::Config* config;
- config = &dc.addConfig("metricsmanager");
- config->set("consumer[2]");
- config->set("consumer[0].name", "\"status\"");
- config->set("consumer[0].addedmetrics[1]");
- config->set("consumer[0].addedmetrics[0]", "\"*\"");
- config->set("consumer[1].name", "\"statereporter\"");
- config->set("consumer[1].addedmetrics[1]");
- config->set("consumer[1].addedmetrics[0]", "\"*\"");
- config = &dc.addConfig("stor-communicationmanager");
- config->set("rpcport", "0");
- config->set("mbusport", "0");
- config = &dc.addConfig("stor-distributormanager");
- config->set("splitcount", "1000");
- config->set("splitsize", "10000000");
- config->set("joincount", "500");
- config->set("joinsize", "5000000");
- config->set("max_clock_skew_sec", "0");
- config = &dc.addConfig("persistence");
- config->set("abort_operations_with_changed_bucket_ownership", "true");
- config = &dc.addConfig("stor-filestor");
- // Easier to see what goes wrong with only 1 thread per disk.
- config->set("num_threads", "1");
- config->set("num_response_threads", "1");
- config = &dc.addConfig("stor-server");
- config->set("cluster_name", clusterName);
- config->set("max_merges_per_node", "25");
- config->set("max_merge_queue_size", "20");
- config->set("resource_exhaustion_merge_back_pressure_duration_secs", "15.0");
- vespalib::string rootFolder = rootOfRoot + "_";
- rootFolder += (storagenode ? "vdsroot" : "vdsroot.distributor");
- config->set("root_folder", rootFolder);
- config->set("is_distributor", (storagenode ? "false" : "true"));
- config->set("write_pid_file_on_startup", "false");
- config = &dc.addConfig("stor-devices");
- config->set("root_folder", rootFolder);
- config = &dc.addConfig("stor-status");
- config->set("httpport", "0");
- config = &dc.addConfig("stor-visitor");
- config->set("defaultdocblocksize", "8192");
- // By default, need "old" behaviour of maxconcurrent
- config->set("maxconcurrentvisitors_fixed", "4");
- config->set("maxconcurrentvisitors_variable", "0");
- config = &dc.addConfig("stor-visitordispatcher");
- addFileConfig(dc, "documenttypes", TEST_PATH("config-doctypes.cfg"));
- addStorageDistributionConfig(dc);
- return dc;
-}
-
-void addSlobrokConfig(vdstestlib::DirConfig& dc,
- const mbus::Slobrok& slobrok)
-{
- std::ostringstream ost;
- ost << "tcp/localhost:" << slobrok.port();
- vdstestlib::DirConfig::Config* config;
- config = &dc.getConfig("slobroks", true);
- config->clear();
- config->set("slobrok[1]");
- config->set("slobrok[0].connectionspec", ost.str());
-}
-
-void addFileConfig(vdstestlib::DirConfig& dc,
- const std::string& configDefName,
- const std::string& fileName)
-{
- vdstestlib::DirConfig::Config* config;
- config = &dc.getConfig(configDefName, true);
- config->clear();
- std::ifstream in(fileName.c_str());
- std::string line;
- while (std::getline(in, line, '\n')) {
- std::string::size_type pos = line.find(' ');
- if (pos == std::string::npos) {
- config->set(line);
- } else {
- config->set(line.substr(0, pos), line.substr(pos + 1));
- }
- }
- in.close();
-}
-
-TestName::TestName(const std::string& n)
- : name(n)
-{
- LOG(debug, "Starting test %s", name.c_str());
-}
-
-TestName::~TestName() {
- LOG(debug, "Done with test %s", name.c_str());
-}
-
-} // storage
diff --git a/storage/src/tests/common/testhelper.h b/storage/src/tests/common/testhelper.h
index 1f83e938409..9f9b50652f9 100644
--- a/storage/src/tests/common/testhelper.h
+++ b/storage/src/tests/common/testhelper.h
@@ -1,39 +1,15 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
+
#include <vespa/config/helper/configgetter.h>
-#include <vespa/messagebus/testlib/slobrok.h>
-#include <vespa/vdstestlib/config/dirconfig.h>
-#include <fstream>
-#include <sstream>
+#include <vespa/config/subscription/configuri.h>
namespace storage {
-void addFileConfig(vdstestlib::DirConfig& dc,
- const std::string& configDefName,
- const std::string& fileName);
-
-
-void addStorageDistributionConfig(vdstestlib::DirConfig& dc);
-
-vdstestlib::DirConfig getStandardConfig(bool storagenode, const std::string & rootFolder = "todo-make-unique");
-
-std::string getRootFolder(vdstestlib::DirConfig & dc);
-
-void addSlobrokConfig(vdstestlib::DirConfig& dc,
- const mbus::Slobrok& slobrok);
-
template <typename ConfigT>
std::unique_ptr<ConfigT> config_from(const ::config::ConfigUri& cfg_uri) {
return ::config::ConfigGetter<ConfigT>::getConfig(cfg_uri.getConfigId(), cfg_uri.getContext());
}
-// Class used to print start and end of test. Enable debug when you want to see
-// which test creates what output or where we get stuck
-struct TestName {
- std::string name;
- TestName(const std::string& n);
- ~TestName();
-};
-
} // storage
diff --git a/storageserver/src/tests/CMakeLists.txt b/storageserver/src/tests/CMakeLists.txt
index db272ccc795..e845c652c87 100644
--- a/storageserver/src/tests/CMakeLists.txt
+++ b/storageserver/src/tests/CMakeLists.txt
@@ -3,12 +3,10 @@
vespa_add_executable(storageserver_gtest_runner_app TEST
SOURCES
storageservertest.cpp
- testhelper.cpp
gtest_runner.cpp
DEPENDS
storageserver_storageapp
storage_testcommon
- vdstestlib
GTest::GTest
)
diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp
index 3e5edc23464..58edcac0c7d 100644
--- a/storageserver/src/tests/storageservertest.cpp
+++ b/storageserver/src/tests/storageservertest.cpp
@@ -1,12 +1,12 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <tests/testhelper.h>
#include <tests/common/storage_config_set.h>
+#include <vespa/messagebus/testlib/slobrok.h>
+#include <vespa/messagebus/message.h>
#include <vespa/storage/storageserver/distributornode.h>
#include <vespa/storage/storageserver/servicelayernode.h>
#include <vespa/storageserver/app/distributorprocess.h>
#include <vespa/storageserver/app/dummyservicelayerprocess.h>
-#include <vespa/messagebus/message.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/log/log.h>
diff --git a/storageserver/src/tests/testhelper.cpp b/storageserver/src/tests/testhelper.cpp
deleted file mode 100644
index e3b047ddfd1..00000000000
--- a/storageserver/src/tests/testhelper.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <tests/testhelper.h>
-
-#include <vespa/log/log.h>
-LOG_SETUP(".testhelper");
-
-namespace storage {
-
-void addStorageDistributionConfig(vdstestlib::DirConfig& dc)
-{
- vdstestlib::DirConfig::Config* config;
- config = &dc.getConfig("stor-distribution", true);
- config->clear();
- config->set("group[1]");
- config->set("group[0].name", "invalid");
- config->set("group[0].index", "invalid");
- config->set("group[0].nodes[50]");
-
- for (uint32_t i = 0; i < 50; i++) {
- std::ostringstream key; key << "group[0].nodes[" << i << "].index";
- std::ostringstream val; val << i;
- config->set(key.str(), val.str());
- }
-}
-
-vdstestlib::DirConfig getStandardConfig(bool storagenode) {
- vdstestlib::DirConfig dc;
- vdstestlib::DirConfig::Config* config;
- config = &dc.addConfig("upgrading");
- config = &dc.addConfig("load-type");
- config = &dc.addConfig("bucket");
- config = &dc.addConfig("messagebus");
- config = &dc.addConfig("stor-prioritymapping");
- config = &dc.addConfig("stor-bucketdbupdater");
- config = &dc.addConfig("metricsmanager");
- config->set("consumer[1]");
- config->set("consumer[0].name", "\"status\"");
- config->set("consumer[0].addedmetrics[1]");
- config->set("consumer[0].addedmetrics[0]", "\"*\"");
- config = &dc.addConfig("stor-communicationmanager");
- config->set("rpcport", "0");
- config->set("mbusport", "0");
- config = &dc.addConfig("stor-distributormanager");
- config = &dc.addConfig("stor-filestor");
- // Easier to see what goes wrong with only 1 thread per disk.
- config->set("threads[1]");
- config->set("threads[0].lowestpri 255");
- config->set("maximum_versions_of_single_document_stored", "0");
- //config->set("enable_slotfile_cache", "false");
- // Unit tests typically use fake low time values, so don't complain
- // about them or compact/delete them by default. Override in tests testing that
- // behavior
- config->set("keep_remove_time_period", "2000000000");
- config->set("revert_time_period", "2000000000");
- config = &dc.addConfig("persistence");
- config->set("keep_remove_time_period", "2000000000");
- config->set("revert_time_period", "2000000000");
- config = &dc.addConfig("stor-bouncer");
- config = &dc.addConfig("stor-integritychecker");
- config = &dc.addConfig("stor-server");
- config->set("enable_dead_lock_detector", "false");
- config->set("enable_dead_lock_detector_warnings", "false");
- config->set("max_merges_per_node", "25");
- config->set("max_merge_queue_size", "20");
- config->set("root_folder", (storagenode ? "vdsroot" : "vdsroot.distributor"));
- config->set("is_distributor", (storagenode ? "false" : "true"));
- config->set("write_pid_file_on_startup", "false");
- config = &dc.addConfig("stor-devices");
- config->set("root_folder", (storagenode ? "vdsroot" : "vdsroot.distributor"));
- config = &dc.addConfig("stor-status");
- config->set("httpport", "0");
- config = &dc.addConfig("stor-visitor");
- config->set("defaultdocblocksize", "8192");
- // By default, need "old" behaviour of maxconcurrent
- config->set("maxconcurrentvisitors_fixed", "4");
- config->set("maxconcurrentvisitors_variable", "0");
- dc.addConfig("stor-visitordispatcher");
- config = &dc.addConfig("bucketspaces");
- config->set("documenttype[1]");
- config->set("documenttype[0].name", "testdoctype1");
- config->set("documenttype[0].bucketspace", "default");
- addFileConfig(dc, "documenttypes", "config-doctypes.cfg");
- addStorageDistributionConfig(dc);
- return dc;
-}
-
-void addSlobrokConfig(vdstestlib::DirConfig& dc, const mbus::Slobrok& slobrok)
-{
- std::ostringstream ost;
- ost << "tcp/localhost:" << slobrok.port();
- vdstestlib::DirConfig::Config* config;
- config = &dc.getConfig("slobroks", true);
- config->clear();
- config->set("slobrok[1]");
- config->set("slobrok[0].connectionspec", ost.str());
-}
-
-void addFileConfig(vdstestlib::DirConfig& dc,
- const std::string& configDefName,
- const std::string& fileName)
-{
- vdstestlib::DirConfig::Config* config;
- config = &dc.getConfig(configDefName, true);
- config->clear();
- std::ifstream in(fileName.c_str());
- std::string line;
- while (std::getline(in, line, '\n')) {
- std::string::size_type pos = line.find(' ');
- if (pos == std::string::npos) {
- config->set(line);
- } else {
- config->set(line.substr(0, pos), line.substr(pos + 1));
- }
- }
- in.close();
-}
-
-} // storage
diff --git a/storageserver/src/tests/testhelper.h b/storageserver/src/tests/testhelper.h
deleted file mode 100644
index 9d0fceee84b..00000000000
--- a/storageserver/src/tests/testhelper.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#pragma once
-
-#include <fstream>
-#include <sstream>
-#include <vespa/messagebus/testlib/slobrok.h>
-#include <vespa/vdstestlib/config/dirconfig.h>
-
-namespace storage {
-
-void addFileConfig(vdstestlib::DirConfig& dc,
- const std::string& configDefName,
- const std::string& fileName);
-
-
-void addStorageDistributionConfig(vdstestlib::DirConfig& dc);
-
-vdstestlib::DirConfig getStandardConfig(bool storagenode);
-
-void addSlobrokConfig(vdstestlib::DirConfig& dc,
- const mbus::Slobrok& slobrok);
-
-} // storage
-
diff --git a/vdslib/CMakeLists.txt b/vdslib/CMakeLists.txt
index cf80f829a44..f3917691af1 100644
--- a/vdslib/CMakeLists.txt
+++ b/vdslib/CMakeLists.txt
@@ -13,9 +13,6 @@ vespa_define_module(
src/vespa/vdslib/distribution
src/vespa/vdslib/state
- TEST_DEPENDS
- vdstestlib
-
TESTS
src/tests
src/tests/container
diff --git a/vdstestlib/.gitignore b/vdstestlib/.gitignore
deleted file mode 100644
index f3c7a7c5da6..00000000000
--- a/vdstestlib/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/vdstestlib/CMakeLists.txt b/vdstestlib/CMakeLists.txt
deleted file mode 100644
index 34f40704b26..00000000000
--- a/vdstestlib/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_define_module(
- DEPENDS
- vespalib
-
- TESTS
- src/tests/dirconfig
-
- LIBS
- src/vespa/vdstestlib
- src/vespa/vdstestlib/config
-)
diff --git a/vdstestlib/OWNERS b/vdstestlib/OWNERS
deleted file mode 100644
index dbcff24b338..00000000000
--- a/vdstestlib/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-vekterli
diff --git a/vdstestlib/src/.gitignore b/vdstestlib/src/.gitignore
deleted file mode 100644
index 2e8e6fd906a..00000000000
--- a/vdstestlib/src/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile.ini
-/config_command.sh
-/project.dsw
diff --git a/vdstestlib/src/tests/dirconfig/.gitignore b/vdstestlib/src/tests/dirconfig/.gitignore
deleted file mode 100644
index d19c58dc3e5..00000000000
--- a/vdstestlib/src/tests/dirconfig/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.depend
-Makefile
-dirconfig.tmp
-dirconfig_test
-vdstestlib_dirconfig_test_app
diff --git a/vdstestlib/src/tests/dirconfig/CMakeLists.txt b/vdstestlib/src/tests/dirconfig/CMakeLists.txt
deleted file mode 100644
index 6a645c65f31..00000000000
--- a/vdstestlib/src/tests/dirconfig/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(vdstestlib_dirconfig_test_app TEST
- SOURCES
- dirconfigtest.cpp
- DEPENDS
- vdstestlib
-)
-vespa_add_test(NAME vdstestlib_dirconfig_test_app NO_VALGRIND COMMAND vdstestlib_dirconfig_test_app)
diff --git a/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp b/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp
deleted file mode 100644
index 1346f9c4ca3..00000000000
--- a/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vdstestlib/config/dirconfig.h>
-#include <fstream>
-#include <iostream>
-
-using namespace vdstestlib;
-
-namespace vespalib {
-
-class Test : public vespalib::TestApp
-{
-public:
- void testNormalUsage();
- int Main() override;
-};
-
-int
-Test::Main()
-{
- TEST_INIT("dirconfig_test");
- srandom(1);
- testNormalUsage();
- TEST_DONE();
-}
-
-#define ASSERT_FILE_CONTENT(file, content) \
-{ \
- std::ifstream in(file); \
- EXPECT_TRUE(bool(in)); \
- std::ostringstream ost; \
- std::string line; \
- while (getline(in, line, '\n')) { \
- ost << line << '\n'; \
- } \
- EXPECT_EQUAL(content, ost.str()); \
-}
-
-void Test::testNormalUsage() {
- DirConfig config1;
- DirConfig config2;
- EXPECT_EQUAL(strncmp("dir:dirconfig.tmp.", config1.getConfigId().c_str(), 18), 0);
- EXPECT_EQUAL(26u, config1.getConfigId().size());
- EXPECT_EQUAL('/', config1.getConfigId()[24]);
- EXPECT_EQUAL('0', config1.getConfigId()[25]);
- EXPECT_EQUAL(strncmp("dir:dirconfig.tmp.", config2.getConfigId().c_str(), 18), 0);
- EXPECT_EQUAL(26u, config2.getConfigId().size());
- EXPECT_EQUAL('/', config2.getConfigId()[24]);
- EXPECT_EQUAL('1', config2.getConfigId()[25]);
-
- try{
- config1.getConfig("testconfig");
- TEST_FATAL("Not supposed to get here");
- } catch (vespalib::Exception& e) {
- EXPECT_EQUAL("No config named testconfig", e.getMessage());
- }
- DirConfig::Config& file1(config1.addConfig("testconfig"));
- try{
- config1.addConfig("testconfig");
- TEST_FATAL("Not supposed to get here");
- } catch (vespalib::Exception& e) {
- EXPECT_EQUAL("There is already a config named testconfig",
- e.getMessage());
- }
- EXPECT_EQUAL(&file1, &config1.getConfig("testconfig"));
- file1.set("intval", "5");
- file1.set("intval", "7");
- file1.set("stringval", "\"foo\"");
- file1.set("tmpval", "4");
- file1.remove("tmpval");
- // Trigger publish
- config1.getConfigId();
-
- ASSERT_FILE_CONTENT(config1.getDir() + "/testconfig.cfg",
- "intval 7\n"
- "stringval \"foo\"\n");
-
- DirConfig::Config& file2(config2.addConfig("testconfig"));
- file2.set("longval", "6");
- file2.clear();
- file2.set("intval", "4");
-
- DirConfig::Config& file3(config1.addConfig("config2"));
- file3.set("intval", "3");
- file3.set("myarray[2]");
- file3.set("myarray[0].foo", "4");
- file3.set("myarray[1].foo", "2");
-
- config1.publish();
- config2.publish();
-
- ASSERT_FILE_CONTENT(config2.getDir() + "/testconfig.cfg",
- "intval 4\n");
- ASSERT_FILE_CONTENT(config1.getDir() + "/config2.cfg",
- "intval 3\n"
- "myarray[2]\n"
- "myarray[0].foo 4\n"
- "myarray[1].foo 2\n");
-
-}
-
-} // vespalib
-
-TEST_APPHOOK(vespalib::Test)
diff --git a/vdstestlib/src/vespa/vdstestlib/.gitignore b/vdstestlib/src/vespa/vdstestlib/.gitignore
deleted file mode 100644
index 1b1547ac3e4..00000000000
--- a/vdstestlib/src/vespa/vdstestlib/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/.depend
-/Makefile
-/libvdstestlib.so.5.1
diff --git a/vdstestlib/src/vespa/vdstestlib/CMakeLists.txt b/vdstestlib/src/vespa/vdstestlib/CMakeLists.txt
deleted file mode 100644
index 2404f032952..00000000000
--- a/vdstestlib/src/vespa/vdstestlib/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_library(vdstestlib
- SOURCES
- $<TARGET_OBJECTS:vdstestlib_vdstestlib_config>
- INSTALL lib64
-)
diff --git a/vdstestlib/src/vespa/vdstestlib/config/.gitignore b/vdstestlib/src/vespa/vdstestlib/config/.gitignore
deleted file mode 100644
index 583460ae288..00000000000
--- a/vdstestlib/src/vespa/vdstestlib/config/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.So
-.depend
-Makefile
diff --git a/vdstestlib/src/vespa/vdstestlib/config/CMakeLists.txt b/vdstestlib/src/vespa/vdstestlib/config/CMakeLists.txt
deleted file mode 100644
index 6af4bcb54f8..00000000000
--- a/vdstestlib/src/vespa/vdstestlib/config/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_library(vdstestlib_vdstestlib_config OBJECT
- SOURCES
- dirconfig.cpp
- DEPENDS
-)
diff --git a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp b/vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp
deleted file mode 100644
index 9584b71d7e7..00000000000
--- a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "dirconfig.hpp"
-
-#include <vespa/vespalib/util/exceptions.h>
-#include <vespa/vespalib/util/stringfmt.h>
-#include <filesystem>
-#include <fstream>
-#include <atomic>
-#include <cassert>
-
-#include <vespa/log/log.h>
-LOG_SETUP(".dirconfig");
-
-namespace vdstestlib {
-
- // When we start up first time, remove old config from the directories
- // we're using
-namespace {
-
-class Root {
-public:
- Root() :
- _nextDir(0)
- {
- memset(_dirname, 0, sizeof(_dirname));
- snprintf(_dirname, sizeof(_dirname), "dirconfig.tmp.XXXXXX");
- char * realName = mkdtemp(_dirname);
- assert(realName == _dirname);
- assert(strlen(realName) < sizeof(_dirname));
- (void) realName;
- }
- ~Root() {
- if (system((std::string("rm -rf ") + _dirname).c_str()) != 0) {
- abort();
- }
- }
-
- std::string nextDir() {
- char name[64];
- uint32_t id = _nextDir++;
- snprintf(name, sizeof(name), "%s/%u", _dirname, id);
- return name;
- }
-private:
- std::string dir() const { return _dirname; }
- char _dirname[32];
- std::atomic<uint32_t> _nextDir;
-};
-
-Root _G_root;
-
-}
-
-DirConfig::Config::Config(const ConfigName& name)
- : defFileName(name),
- config(),
- dirtyCache(false)
-{
-}
-
-DirConfig::Config::~Config() {}
-
-void
-DirConfig::Config::set(const ConfigKey& key)
-{
- set(key, "");
-}
-
-void
-DirConfig::Config::set(const ConfigKey& key, const ConfigValue& value)
-{
- for (std::list<std::pair<ConfigKey, ConfigValue> >::iterator it
- = config.begin(); it != config.end(); ++it)
- {
- if (it->first == key) {
- if (it->second == value) return;
- dirtyCache = true;
- it->second = value;
- return;
- }
- }
- dirtyCache = true;
- config.push_back(std::pair<ConfigKey, ConfigValue>(key, value));
-}
-
-void
-DirConfig::Config::remove(const ConfigKey& key)
-{
- for (std::list<std::pair<ConfigKey, ConfigValue> >::iterator it
- = config.begin(); it != config.end(); ++it)
- {
- if (it->first == key) {
- dirtyCache = true;
- config.erase(it);
- return;
- }
- }
-}
-
-const DirConfig::ConfigValue*
-DirConfig::Config::get(const ConfigKey& key) const
-{
- for (std::list<std::pair<ConfigKey, ConfigValue> >::const_iterator it
- = config.begin(); it != config.end(); ++it)
- {
- if (it->first == key) {
- return &it->second;
- }
- }
- return 0;
-}
-
-DirConfig::DirConfig()
- : _configs(),
- _dirName(_G_root.nextDir())
-{
- std::filesystem::create_directories(std::filesystem::path(_dirName));
-}
-
-DirConfig::~DirConfig() {}
-
-DirConfig::Config&
-DirConfig::addConfig(const ConfigName& name)
-{
- std::pair<std::map<ConfigName, Config>::iterator, bool> result
- = _configs.insert(
- std::map<ConfigName, Config>::value_type(name, Config(name)));
- if (!result.second) {
- throw vespalib::IllegalArgumentException(
- "There is already a config named " + name, VESPA_STRLOC);
- }
- return result.first->second;
-}
-
-DirConfig::Config&
-DirConfig::getConfig(const ConfigName& name, bool createIfNonExisting)
-{
- std::map<ConfigName, Config>::iterator it(_configs.find(name));
- if (it == _configs.end()) {
- if (createIfNonExisting) {
- return addConfig(name);
- }
- throw vespalib::IllegalArgumentException(
- "No config named " + name, VESPA_STRLOC);
- }
- return it->second;
-}
-
-void
-DirConfig::removeConfig(const ConfigName& name)
-{
- _configs.erase(name);
-}
-
-void
-DirConfig::publish() const
-{
- for (std::map<ConfigName, Config>::const_iterator it = _configs.begin();
- it != _configs.end(); ++it)
- {
- std::string filename = _dirName + "/" + it->first + ".cfg";
- std::ofstream out(filename.c_str());
- for (std::list<std::pair<ConfigKey, ConfigValue> >::const_iterator i
- = it->second.config.begin(); i != it->second.config.end(); ++i)
- {
- if (i->second.size() > 0) {
- out << i->first << " " << i->second << "\n";
- } else {
- out << i->first << "\n";
- }
- }
- out.close();
- LOG(debug, "Wrote config file %s.", filename.c_str());
- it->second.dirtyCache = false;
- }
-}
-
-std::string
-DirConfig::getConfigId() const
-{
- // Users are likely to set up config and then give config ids to users.
- // This is thus a good place to automatically publish changes so users
- // dont need to call publish manually
- if (isCacheDirty()) {
- LOG(debug, "Cache dirty in getConfigId(). Writing config files.");
- publish();
- }
- return "dir:" + _dirName;
-}
-
-bool
-DirConfig::isCacheDirty() const
-{
- for (std::map<ConfigName, Config>::const_iterator it = _configs.begin();
- it != _configs.end(); ++it)
- {
- if (it->second.dirtyCache) return true;
- }
- return false;
-}
-
-template void DirConfig::Config::setValue(const ConfigKey &, const int &);
-template std::string DirConfig::Config::getValue(const ConfigKey &, const std::string &) const;
-
-} // storage
diff --git a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.h b/vdstestlib/src/vespa/vdstestlib/config/dirconfig.h
deleted file mode 100644
index 39660ee2a49..00000000000
--- a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/**
- * \class vdstestlib::DirConfig
- * \ingroup config
- *
- * \brief Helper class for generating dir config
- *
- * Some components use the same config identifier for config of multiple
- * types. This can not be represented in file or raw config specifications.
- * This helper class make it easy to use dir config, while not generating a
- * lot of config files to check in, but keeping the config that needs to be
- * changed programmatically in the unit test itself.
- *
- * To not make the class complex, all config entries are just key/value pairs.
- * For string config entries make sure you include the double quotes in the
- * value.
- */
-#pragma once
-
-#include <list>
-#include <map>
-#include <string>
-
-namespace vdstestlib {
-
-struct DirConfig {
- // Make some aliases to make it easy to see in header file what is what
- typedef std::string ConfigName;
- typedef std::string ConfigKey;
- typedef std::string ConfigValue;
-
- struct Config {
- ConfigName defFileName;
- std::list<std::pair<ConfigKey, ConfigValue> > config;
- mutable bool dirtyCache;
-
- Config(const ConfigName&);
- ~Config();
-
- void clear() { config.clear(); }
- void set(const ConfigKey&); // Set valueless key, such as array size
- void set(const ConfigKey&, const ConfigValue&);
- template<typename T>
- void setValue(const ConfigKey& key, const T& value);
- void remove(const ConfigKey&);
- const ConfigValue* get(const ConfigKey&) const;
- template<typename T>
- T getValue(const ConfigKey& key, const T& defVal) const;
- };
-
- DirConfig();
- ~DirConfig();
-
- // Adjusts the memory representation of this config.
- // publish() to push the config from memory to files.
- Config& addConfig(const ConfigName&); // Complain if existing
- Config& getConfig(const ConfigName&, bool createIfNonExisting = false);
- void removeConfig(const ConfigName&);
-
- /** Write the configs given to file. */
- void publish() const;
-
- /** Get the id that should be used to get config from this instance. */
- std::string getConfigId() const;
- std::string getDir() const { return _dirName; }
-
- /** Return whether memory representation currently differ from files. */
- bool isCacheDirty() const;
-
-private:
- static unsigned int _nextDir;
- std::map<ConfigName, Config> _configs;
- std::string _dirName;
-};
-
-} // storage
-
diff --git a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.hpp b/vdstestlib/src/vespa/vdstestlib/config/dirconfig.hpp
deleted file mode 100644
index 17e2f7363e6..00000000000
--- a/vdstestlib/src/vespa/vdstestlib/config/dirconfig.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vespa/vdstestlib/config/dirconfig.h>
-
-#include <sstream>
-#include <boost/lexical_cast.hpp>
-
-namespace vdstestlib {
-
-template<typename T>
-void
-DirConfig::Config::setValue(const ConfigKey& key, const T& value)
-{
- std::ostringstream ost;
- ost << value;
- set(key, ost.str());
-}
-
-template<typename T>
-T
-DirConfig::Config::getValue(const ConfigKey& key, const T& defVal) const
-{
- const ConfigValue* val(get(key));
- if (val == 0) return defVal;
- return boost::lexical_cast<T>(*val);
-}
-
-} // storage
diff --git a/vdstestlib/testrun/.gitignore b/vdstestlib/testrun/.gitignore
deleted file mode 100644
index 4c3fd7fadbb..00000000000
--- a/vdstestlib/testrun/.gitignore
+++ /dev/null
@@ -1,19 +0,0 @@
-/test-report.html
-/test-report.html.bottom
-/test-report.html.entry
-/test-report.html.summary
-/test-report.html.top
-/test.1.cppunit.desc.file.txt
-/test.1.cppunit.files.html
-/test.1.cppunit.log.file.txt
-/test.2.dirconfig.desc.file.txt
-/test.2.dirconfig.file.dirconfigtest.cpp.txt
-/test.2.dirconfig.files.html
-/test.2.dirconfig.log.file.txt
-/tmp.cppunit-time
-/tmp.cppunit.log-control
-/tmp.dirconfig-time
-/tmp.dirconfig.log-control
-/tmp.end-time
-/tmp.start-time
-/test.*.*.result