osquery-1/tests/integration/tables/system_controls.cpp

60 lines
1.6 KiB
C++
Raw Normal View History

2018-08-27 16:21:26 +00:00
/**
* 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.
2018-08-27 16:21:26 +00:00
*/
// Sanity check integration test for system_controls
// Spec file: specs/posix/system_controls.table
#include <osquery/tests/integration/tables/helper.h>
namespace osquery {
namespace table_tests {
namespace {
2018-08-27 16:21:26 +00:00
class SystemControlsTest : public testing::Test {
protected:
void SetUp() override {
setUpEnvironment();
}
};
2018-08-27 16:21:26 +00:00
TEST_F(SystemControlsTest, test_sanity) {
auto const rows = execute_query("select * from system_controls");
auto const row_map = ValidationMap{
{"name", NonEmptyString},
{"oid", NormalType},
{"subsystem",
SpecificValuesCheck{"",
"abi",
"debug",
"dev",
"fs",
"fscache",
"hw",
"kern",
"kernel",
"machdep",
"net",
"user",
"vfs",
"vm"}},
{"current_value", NormalType},
{"config_value", NormalType},
{"type",
SpecificValuesCheck{
"", "node", "int", "string", "quad", "opaque", "struct"}},
#ifdef __APPLE__
{"field_name", NormalType},
#endif
};
validate_rows(rows, row_map);
2018-08-27 16:21:26 +00:00
}
} // namespace
} // namespace table_tests
2018-08-27 16:21:26 +00:00
} // namespace osquery