mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-06 17:45:22 +00:00
[Table sanity check] chocolatey_packages (#5871)
This commit is contained in:
parent
2a4acdbd53
commit
6a20e79424
@ -14,33 +14,25 @@
|
||||
namespace osquery {
|
||||
namespace table_tests {
|
||||
|
||||
class chocolateyPackages : public testing::Test {
|
||||
class ChocolateyPackagesTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
setUpEnvironment();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(chocolateyPackages, test_sanity) {
|
||||
// 1. Query data
|
||||
TEST_F(ChocolateyPackagesTest, test_sanity) {
|
||||
auto const data = execute_query("select * from chocolatey_packages");
|
||||
// 2. Check size before validation
|
||||
// ASSERT_GE(data.size(), 0ul);
|
||||
// ASSERT_EQ(data.size(), 1ul);
|
||||
// ASSERT_EQ(data.size(), 0ul);
|
||||
// 3. Build validation map
|
||||
// See helper.h for avaialbe flags
|
||||
// Or use custom DataCheck object
|
||||
// ValidationMap row_map = {
|
||||
// {"name", NormalType}
|
||||
// {"version", NormalType}
|
||||
// {"summary", NormalType}
|
||||
// {"author", NormalType}
|
||||
// {"license", NormalType}
|
||||
// {"path", NormalType}
|
||||
//}
|
||||
// 4. Perform validation
|
||||
// validate_rows(data, row_map);
|
||||
|
||||
ValidationMap row_map = {
|
||||
{"name", NormalType},
|
||||
{"version", NormalType},
|
||||
{"summary", NormalType},
|
||||
{"author", NormalType},
|
||||
{"license", NormalType},
|
||||
{"path", NonEmptyString},
|
||||
};
|
||||
validate_rows(data, row_map);
|
||||
}
|
||||
|
||||
} // namespace table_tests
|
||||
|
Loading…
Reference in New Issue
Block a user