forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule_bootstrap_test.cpp
More file actions
57 lines (51 loc) · 2.26 KB
/
Copy pathmodule_bootstrap_test.cpp
File metadata and controls
57 lines (51 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2021-present StarRocks, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "connector/connector_registry.h"
#include "connector_primitive/connector.h"
#include "gtest/gtest.h"
#include "module/connector_bootstrap.h"
namespace starrocks::connector {
TEST(ModuleBootstrapTest, BootstrapBuiltinConnectorsInstallsConnectorsIdempotently) {
auto* registry = ConnectorRegistry::default_instance();
ASSERT_NE(nullptr, registry);
auto status = bootstrap_builtin_connectors();
ASSERT_TRUE(status.ok()) << status;
const auto* cache_stats = registry->get(Connector::CACHE_STATS);
ASSERT_NE(nullptr, cache_stats);
EXPECT_EQ(ConnectorType::CACHE_STATS, cache_stats->connector_type());
const auto* hive = registry->get(Connector::HIVE);
ASSERT_NE(nullptr, hive);
EXPECT_EQ(ConnectorType::HIVE, hive->connector_type());
const auto* file = registry->get(Connector::FILE);
ASSERT_NE(nullptr, file);
EXPECT_EQ(ConnectorType::FILE, file->connector_type());
const auto* lake = registry->get(Connector::LAKE);
ASSERT_NE(nullptr, lake);
EXPECT_EQ(ConnectorType::LAKE, lake->connector_type());
#ifndef __APPLE__
const auto* iceberg = registry->get(Connector::ICEBERG);
ASSERT_NE(nullptr, iceberg);
EXPECT_EQ(ConnectorType::ICEBERG, iceberg->connector_type());
#endif
status = bootstrap_builtin_connectors();
ASSERT_TRUE(status.ok()) << status;
EXPECT_EQ(cache_stats, registry->get(Connector::CACHE_STATS));
EXPECT_EQ(hive, registry->get(Connector::HIVE));
EXPECT_EQ(file, registry->get(Connector::FILE));
EXPECT_EQ(lake, registry->get(Connector::LAKE));
#ifndef __APPLE__
EXPECT_EQ(iceberg, registry->get(Connector::ICEBERG));
#endif
}
} // namespace starrocks::connector