Skip to content

Commit

Permalink
Merge pull request #31192 from vespa-engine/vekterli/prune-unused-old…
Browse files Browse the repository at this point in the history
…-configs

Cleanup old and unused configs in tests
  • Loading branch information
baldersheim authored May 13, 2024
2 parents efde621 + afdd8ea commit e59b79f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 52 deletions.
20 changes: 0 additions & 20 deletions storage/src/tests/common/testhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ vdstestlib::DirConfig getStandardConfig(bool storagenode, const std::string & ro
std::string clusterName("storage");
vdstestlib::DirConfig dc;
vdstestlib::DirConfig::Config* config;
config = &dc.addConfig("fleetcontroller");
config->set("cluster_name", clusterName);
config->set("index", "0");
config->set("zookeeper_server", "\"\"");
config->set("total_distributor_count", "10");
config->set("total_storage_count", "10");
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[2]");
config->set("consumer[0].name", "\"status\"");
Expand All @@ -71,16 +59,8 @@ vdstestlib::DirConfig getStandardConfig(bool storagenode, const std::string & ro
// Easier to see what goes wrong with only 1 thread per disk.
config->set("num_threads", "1");
config->set("num_response_threads", "1");
config->set("maximum_versions_of_single_document_stored", "0");
config->set("keep_remove_time_period", "2000000000");
config->set("revert_time_period", "2000000000");
// Don't want test to call exit()
config->set("fail_disk_after_error_count", "0");
config = &dc.addConfig("stor-bouncer");
config = &dc.addConfig("stor-server");
config->set("cluster_name", clusterName);
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("resource_exhaustion_merge_back_pressure_duration_secs", "15.0");
Expand Down
5 changes: 2 additions & 3 deletions storage/src/tests/common/teststorageapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@ TestStorageApp::TestStorageApp(StorageComponentRegisterImpl::UP compReg,
_node_identity("test_cluster", type, index),
_initialized(false)
{
// Use config to adjust values
// Use config to adjust values
vespalib::string clusterName = "mycluster";
uint32_t redundancy = 2;
uint32_t nodeCount = 10;
if (!configId.empty()) {
config::ConfigUri uri(configId);
std::unique_ptr<vespa::config::content::core::StorServerConfig> serverConfig = config::ConfigGetter<vespa::config::content::core::StorServerConfig>::getConfig(uri.getConfigId(), uri.getContext());
auto serverConfig = config::ConfigGetter<vespa::config::content::core::StorServerConfig>::getConfig(uri.getConfigId(), uri.getContext());
clusterName = serverConfig->clusterName;
if (index == 0xffff) index = serverConfig->nodeIndex;
redundancy = config::ConfigGetter<vespa::config::content::StorDistributionConfig>::getConfig(uri.getConfigId(), uri.getContext())->redundancy;
nodeCount = config::ConfigGetter<vespa::config::content::FleetcontrollerConfig>::getConfig(uri.getConfigId(), uri.getContext())->totalStorageCount;
} else {
if (index == 0xffff) index = 0;
}
Expand Down
31 changes: 5 additions & 26 deletions storage/src/tests/persistence/filestorage/filestormanagertest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ struct FileStorTestBase : Test {
enum {LONG_WAITTIME=60};
unique_ptr<TestServiceLayerApp> _node;
std::unique_ptr<vdstestlib::DirConfig> config;
std::unique_ptr<vdstestlib::DirConfig> config2;
std::unique_ptr<vdstestlib::DirConfig> smallConfig;
const int32_t _waitTime;
const document::DocumentType* _testdoctype1;

Expand Down Expand Up @@ -167,27 +165,8 @@ struct FileStorTestBase : Test {
std::string rootOfRoot = "filestormanagertest";
config = std::make_unique<vdstestlib::DirConfig>(getStandardConfig(true, rootOfRoot));

config2 = std::make_unique<vdstestlib::DirConfig>(*config);
config2->getConfig("stor-server").set("root_folder", rootOfRoot + "-vdsroot.2");
config2->getConfig("stor-devices").set("root_folder", rootOfRoot + "-vdsroot.2");
config2->getConfig("stor-server").set("node_index", "1");

smallConfig = std::make_unique<vdstestlib::DirConfig>(*config);
vdstestlib::DirConfig::Config& c(smallConfig->getConfig("stor-filestor", true));
c.set("initial_index_read", "128");
c.set("use_direct_io", "false");
c.set("maximum_gap_to_read_through", "64");

assert(system(vespalib::make_string("rm -rf %s", getRootFolder(*config).c_str()).c_str()) == 0);
assert(system(vespalib::make_string("rm -rf %s", getRootFolder(*config2).c_str()).c_str()) == 0);
assert(system(vespalib::make_string("mkdir -p %s/disks/d0", getRootFolder(*config).c_str()).c_str()) == 0);
assert(system(vespalib::make_string("mkdir -p %s/disks/d0", getRootFolder(*config2).c_str()).c_str()) == 0);
try {
_node = std::make_unique<TestServiceLayerApp>(NodeIndex(0), config->getConfigId());
_node->setupDummyPersistence();
} catch (config::InvalidConfigException& e) {
fprintf(stderr, "%s\n", e.what());
}
_node = std::make_unique<TestServiceLayerApp>(NodeIndex(0), config->getConfigId());
_node->setupDummyPersistence();
_testdoctype1 = _node->getTypeRepo()->getDocumentType("testdoctype1");
}

Expand Down Expand Up @@ -227,10 +206,10 @@ struct TestFileStorComponents {
DummyStorageLink top;
FileStorManager* manager;

explicit TestFileStorComponents(FileStorTestBase& test, bool use_small_config = false)
explicit TestFileStorComponents(FileStorTestBase& test)
: manager(nullptr)
{
auto config_uri = config::ConfigUri((use_small_config ? test.smallConfig : test.config)->getConfigId());
auto config_uri = config::ConfigUri(test.config->getConfigId());
auto config = config_from<StorFilestorConfig>(config_uri);
auto fsm = std::make_unique<FileStorManager>(*config, test._node->getPersistenceProvider(),
test._node->getComponentRegister(), *test._node, test._node->get_host_info());
Expand Down Expand Up @@ -1255,7 +1234,7 @@ createIterator(DummyStorageLink& link,
}

TEST_F(FileStorManagerTest, visiting) {
TestFileStorComponents c(*this, true);
TestFileStorComponents c(*this);
auto& top = c.top;
// Adding documents to two buckets which we are going to visit
// We want one bucket in one slotfile, and one bucket with a file split
Expand Down
6 changes: 3 additions & 3 deletions storage/src/tests/persistence/mergehandlertest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ void
MergeHandlerTest::setUpChain(ChainPos pos) {
_nodes.clear();
if (pos != FRONT) {
_nodes.push_back(api::MergeBucketCommand::Node(2, false));
_nodes.emplace_back(2, false);
}
_nodes.push_back(api::MergeBucketCommand::Node(0, false));
_nodes.emplace_back(0, false);
if (pos != BACK) {
_nodes.push_back(api::MergeBucketCommand::Node(1, false));
_nodes.emplace_back(1, false);
}
}

Expand Down

0 comments on commit e59b79f

Please sign in to comment.