osquery-1/tests/integration/tables/deb_packages.cpp
Jesse Kornblum c7355b19aa Update osquery licensing wording (#5452)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5452

As suggested in another diff, this diff updates the language we use to describe the osquery licensing terms. We are changing all instances of

//This source code is licensed as defined on the LICENSE file found in the root directory of this source tree.//

to

//This source code is licensed in accordance with the terms specified in the LICENSE file found in the root directory of this source tree.//

We accomplish this with a codemod:

  $ codemod -md xplat/osquery/oss --extensions cpp,h,in,py,sh,mm,ps1 "(.\s+)This source code is licensed as defined on the LICENSE file found in the(.*)root directory of this source tree\." "\1This source code is licensed in accordance with the terms specified in\2the LICENSE file found in the root directory of this source tree."

Reviewed By: fmanco

Differential Revision: D14131290

fbshipit-source-id: 52c90da342263e2a80f5a678ecd760c19cf7513e
2019-02-19 10:59:48 -08:00

58 lines
1.5 KiB
C++

/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed in accordance with the terms specified in
* the LICENSE file found in the root directory of this source tree.
*/
// Sanity check integration test for deb_packages
// Spec file: specs/linux/deb_packages.table
#include <osquery/tests/integration/tables/helper.h>
#include <osquery/logger.h>
namespace osquery {
namespace table_tests {
class DebPackages : public testing::Test {
protected:
void SetUp() override {
setUpEnvironment();
}
};
TEST_F(DebPackages, test_sanity) {
QueryData rows = execute_query("select * from deb_packages");
if (rows.size() > 0) {
ValidatatioMap row_map = {
{"name", NonEmptyString},
{"version", NonEmptyString},
{"source", NormalType},
{"size", IntType},
{"arch", NonEmptyString},
{"revision", NormalType},
};
validate_rows(rows, row_map);
auto all_packages = std::unordered_set<std::string>{};
for (const auto& row : rows) {
auto pckg_name = row.at("name");
all_packages.insert(pckg_name);
}
ASSERT_EQ(all_packages.count("dpkg"), 1u);
ASSERT_EQ(all_packages.count("linux-base"), 1u);
ASSERT_EQ(all_packages.count("linux-firmware"), 1u);
ASSERT_EQ(all_packages.count("linux-generic"), 1u);
} else {
LOG(WARNING) << "Empty results of query from 'deb_packages', assume there "
"is no dpkg in the system";
}
}
} // namespace table_tests
} // namespace osquery