The following issues were found
src/mongo/s/catalog/type_collection_test.cpp
1 issues
Line: 41
using unittest::assertGet;
TEST(CollectionType, Empty) {
ASSERT_THROWS(CollectionType(BSONObj()), DBException);
}
TEST(CollectionType, Basic) {
const OID oid = OID::gen();
Reported by Cppcheck.
src/mongo/s/catalog/type_config_version_test.cpp
1 issues
Line: 45
using namespace mongo;
TEST(Validity, Empty) {
//
// Tests parsing of empty document
//
BSONObj emptyObj = BSONObj();
Reported by Cppcheck.
src/mongo/s/catalog/type_database_test.cpp
1 issues
Line: 43
using namespace mongo;
using std::string;
TEST(DatabaseType, Empty) {
StatusWith<DatabaseType> status = DatabaseType::fromBSON(BSONObj());
ASSERT_FALSE(status.isOK());
}
TEST(DatabaseType, Basic) {
Reported by Cppcheck.
src/mongo/s/catalog/type_mongos_test.cpp
1 issues
Line: 42
using namespace mongo;
TEST(Validity, MissingName) {
BSONObj obj = BSON(MongosType::ping(Date_t::fromMillisSinceEpoch(1))
<< MongosType::uptime(100) << MongosType::waiting(false)
<< MongosType::mongoVersion("x.x.x") << MongosType::configVersion(0)
<< MongosType::advisoryHostFQDNs(BSONArrayBuilder().arr()));
Reported by Cppcheck.
src/mongo/s/catalog/type_shard_test.cpp
1 issues
Line: 44
using std::string;
TEST(ShardType, MissingName) {
BSONObj obj = BSON(ShardType::host("localhost:27017"));
StatusWith<ShardType> shardRes = ShardType::fromBSON(obj);
ASSERT_FALSE(shardRes.isOK());
}
Reported by Cppcheck.
src/mongo/s/catalog/type_tags_test.cpp
1 issues
Line: 44
using std::string;
TEST(TagsType, Valid) {
BSONObj obj =
BSON(TagsType::ns("test.mycol") << TagsType::tag("tag") << TagsType::min(BSON("a" << 10))
<< TagsType::max(BSON("a" << 20)));
StatusWith<TagsType> status = TagsType::fromBSON(obj);
Reported by Cppcheck.
src/mongo/s/catalog_cache_refresh_test.cpp
1 issues
Line: 103
}
};
TEST_F(CatalogCacheRefreshTest, FullLoad) {
const OID epoch = OID::gen();
const ShardKeyPattern shardKeyPattern(BSON("_id" << 1));
const UUID reshardingUUID = UUID::gen();
auto future = scheduleRoutingInfoUnforcedRefresh(kNss);
Reported by Cppcheck.
src/mongo/s/catalog_cache_test.cpp
1 issues
Line: 182
std::unique_ptr<CatalogCache> _catalogCache;
};
TEST_F(CatalogCacheTest, GetDatabase) {
const auto dbName = "testDB";
const auto dbVersion = DatabaseVersion(UUID::gen(), Timestamp());
_catalogCacheLoader->setDatabaseRefreshReturnValue(
DatabaseType(dbName, kShards[0], true, dbVersion));
Reported by Cppcheck.
src/mongo/s/chunk_manager_index_bounds_test.cpp
1 issues
Line: 130
};
// { a: 2 } -> a: [2, 2]
TEST_F(CMCollapseTreeTest, Basic) {
OrderedIntervalList expected;
expected.intervals.push_back(Interval(BSON("" << 2 << "" << 2), true, true));
checkIndexBounds("{a: 2}", expected);
}
Reported by Cppcheck.
src/mongo/s/chunk_manager_query_test.cpp
1 issues
Line: 110
}
};
TEST_F(ChunkManagerQueryTest, GetShardIdsForRangeMinAndMaxAreInclusive) {
runGetShardIdsForRangeTest(BSON("a" << 1),
false,
{BSON("a" << -100), BSON("a" << 0), BSON("a" << 100)},
BSON("a" << -100),
BSON("a" << 0),
Reported by Cppcheck.