mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 19:32:07 +00:00
13db65f47c
If ReplicatedAccessStorage startup was not executing or if it failed before completing (for instance when ZooKeeper was not configured), its destructor would call shutdown and try to join a missing thread.
47 lines
850 B
C++
47 lines
850 B
C++
#include <gtest/gtest.h>
|
|
#include <Access/ReplicatedAccessStorage.h>
|
|
|
|
using namespace DB;
|
|
|
|
namespace DB
|
|
{
|
|
namespace ErrorCodes
|
|
{
|
|
extern const int NO_ZOOKEEPER;
|
|
}
|
|
}
|
|
|
|
|
|
TEST(ReplicatedAccessStorage, ShutdownWithoutStartup)
|
|
{
|
|
auto get_zk = []()
|
|
{
|
|
return std::shared_ptr<zkutil::ZooKeeper>();
|
|
};
|
|
|
|
auto storage = ReplicatedAccessStorage("replicated", "/clickhouse/access", get_zk);
|
|
storage.shutdown();
|
|
}
|
|
|
|
|
|
TEST(ReplicatedAccessStorage, ShutdownWithFailedStartup)
|
|
{
|
|
auto get_zk = []()
|
|
{
|
|
return std::shared_ptr<zkutil::ZooKeeper>();
|
|
};
|
|
|
|
auto storage = ReplicatedAccessStorage("replicated", "/clickhouse/access", get_zk);
|
|
try
|
|
{
|
|
storage.startup();
|
|
}
|
|
catch (Exception & e)
|
|
{
|
|
if (e.code() != ErrorCodes::NO_ZOOKEEPER)
|
|
throw;
|
|
}
|
|
storage.shutdown();
|
|
}
|
|
|