The following issues were found
src/mongo/db/free_mon/free_mon_queue_test.cpp
1 issues
Line: 87
}
// Postive: Can we enqueue and dequeue one item
TEST_F(FreeMonQueueTest, TestBasic) {
FreeMonMessageQueue queue;
queue.enqueue(FreeMonMessage::createNow(FreeMonMessageType::RegisterServer));
auto item = queue.dequeue(_opCtx.get()->getServiceContext()->getPreciseClockSource());
Reported by Cppcheck.
src/mongo/db/free_mon/free_mon_storage.cpp
1 issues
Line: 54
Column: 54
CWE codes:
120
20
constexpr StringData FreeMonStorage::kFreeMonDocIdKey;
boost::optional<FreeMonStorageState> FreeMonStorage::read(OperationContext* opCtx) {
BSONObj deleteKey = BSON("_id" << kFreeMonDocIdKey);
BSONElement elementKey = deleteKey.firstElement();
auto storageInterface = repl::StorageInterface::get(opCtx);
Reported by FlawFinder.
src/mongo/db/free_mon/free_mon_storage.h
1 issues
Line: 53
Column: 49
CWE codes:
120
20
/**
* Reads document from disk if it exists.
*/
static boost::optional<FreeMonStorageState> read(OperationContext* opCtx);
/**
* Replaces document on disk with contents of document. Creates document if it does not exist.
*/
static void replace(OperationContext* opCtx, const FreeMonStorageState& doc);
Reported by FlawFinder.
src/mongo/db/ftdc/compressor_test.cpp
1 issues
Line: 67
class FTDCCompressorTest : public FTDCTest {};
// Sanity check
TEST_F(FTDCCompressorTest, TestBasic) {
FTDCConfig config;
FTDCCompressor c(&config);
auto st = c.addSample(BSON("name"
<< "joe"
Reported by Cppcheck.
src/mongo/db/ftdc/controller_test.cpp
1 issues
Line: 163
};
// Test a run of the controller and the data it logs to log file
TEST_F(FTDCControllerTest, TestFull) {
unittest::TempDir tempdir("metrics_testpath");
boost::filesystem::path dir(tempdir.path());
createDirectoryClean(dir);
Reported by Cppcheck.
src/mongo/db/ftdc/file_reader.h
1 issues
Line: 62
Column: 12
CWE codes:
362
/**
* Open the specified file
*/
Status open(const boost::filesystem::path& file);
/**
* Returns true if their are more records in the file.
* Returns false if the end of the file has been reached.
* Return other error codes if the file is corrupt.
Reported by FlawFinder.
src/mongo/db/ftdc/file_writer.h
1 issues
Line: 72
Column: 12
CWE codes:
362
/**
* Open both an archive file, and interim file.
*/
Status open(const boost::filesystem::path& file);
/**
* Write a BSON document as a metadata type to the archive log.
*/
Status writeMetadata(const BSONObj& metadata, Date_t date);
Reported by FlawFinder.
src/mongo/db/ftdc/ftdc_test.cpp
1 issues
Line: 70
Column: 22
CWE codes:
362
FTDCValidationMode mode) {
FTDCFileReader reader;
ASSERT_OK(reader.open(p));
std::vector<BSONObj> list;
auto sw = reader.hasNext();
while (sw.isOK() && sw.getValue()) {
list.emplace_back(std::get<1>(reader.next()).getOwned());
Reported by FlawFinder.
src/mongo/db/ftdc/ftdc_util_test.cpp
1 issues
Line: 43
}
// Validate time rounding
TEST(FTDCUtilTest, TestRoundTime) {
checkTime(4, 3, 1);
checkTime(7, 3, 7);
checkTime(14, 8, 7);
checkTime(14, 13, 7);
}
Reported by Cppcheck.
src/mongo/db/fts/fts_basic_phrase_matcher_test.cpp
1 issues
Line: 58
}
// Case sensitive match.
TEST(FtsBasicPhraseMatcher, CaseSensitive) {
std::string str1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
std::string find1 = "Lorem ipsum";
std::string nofind1 = "Sit amet";
std::string str2 = "Duis aute irure dolor in reprehenderit in Voluptate velit esse cillum.";
Reported by Cppcheck.