Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
directionless committed Dec 7, 2019
1 parent c9ed4bc commit ee0d19c
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 135 deletions.
37 changes: 13 additions & 24 deletions tests/integration/tables/apps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,25 @@ class apps : public testing::Test {
};

TEST_F(apps, test_sanity) {
ValidationMap row_map = {
{"name", NormalType}
{"path", NormalType}
{"bundle_executable", NormalType}
{"bundle_identifier", NormalType}
{"bundle_name", NormalType}
{"bundle_short_version", NormalType}
{"bundle_version", NormalType}
{"bundle_package_type", NormalType}
{"environment", NormalType}
{"element", NormalType}
{"compiler", NormalType}
{"development_region", NormalType}
{"display_name", NormalType}
{"info_string", NormalType}
{"minimum_system_version", NormalType}
{"category", NormalType}
{"applescript_enabled", NormalType}
{"copyright", NormalType}
{"last_opened_time", NormalType}
}

ValidationMap row_map =
{ {"name", NormalType} {"path", NormalType} {
"bundle_executable", NormalType} {"bundle_identifier", NormalType} {
"bundle_name", NormalType} {"bundle_short_version", NormalType} {
"bundle_version", NormalType} {"bundle_package_type", NormalType} {
"environment", NormalType} {"element", NormalType} {
"compiler", NormalType} {"development_region", NormalType} {
"display_name", NormalType} {"info_string", NormalType} {
"minimum_system_version", NormalType} {"category", NormalType} {
"applescript_enabled", NormalType} {"copyright", NormalType} {
"last_opened_time", NormalType} }

auto const data = execute_query("select * from apps");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);

// Not totally sure what apps we expect on the VMs used by CI.
auto const data1 = execute_query("select '/Applications/Preview.app' from apps");
auto const data1 =
execute_query("select '/Applications/Preview.app' from apps");
ASSERT_EQ(data.size(), 1ul);
validate_rows(data, row_map);

Expand All @@ -60,7 +50,6 @@ TEST_F(apps, test_sanity) {
// See helper.h for avaialbe flags
// Or use custom DataCheck object
// 4. Perform validation

}

} // namespace table_tests
Expand Down
32 changes: 14 additions & 18 deletions tests/integration/tables/asl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,21 @@ class asl : public testing::Test {
};

TEST_F(asl, test_sanity) {
ValidationMap row_map = {
{"time", IntType}
{"time_nano_sec", IntType}
{"host", NormalType}
{"sender", NormalType}
{"facility", NormalType}
{"pid", IntType}
{"gid", IntType}
{"uid", IntType}
{"level", IntType}
{"message", NormalType}
{"ref_pid", IntType}
{"ref_proc", NormalType}
{"extra", NormalType}
}
{"message", NormalType} {"ref_pid", IntType} {"ref_proc", NormalType} {
"extra", NormalType
}
}
"gid", IntType
} // namespace table_tests
{"uid", IntType} {"level", IntType} {"message", NormalType} {
"ref_pid", IntType} {"ref_proc", NormalType} {
"extra", NormalType
}
} // namespace osquery

auto const data = execute_query("select * from asl limit 5");
ASSERT_GT(data.size(), 1ul);
validate_rows(data, row_map);
auto const data = execute_query("select * from asl limit 5");
ASSERT_GT(data.size(), 1ul);
validate_rows(data, row_map);
}

} // namespace table_tests
Expand Down
35 changes: 14 additions & 21 deletions tests/integration/tables/browser_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,20 @@ class browserPlugins : public testing::Test {
};

TEST_F(browserPlugins, test_sanity) {
ValidationMap row_map = {
{"uid", IntType}
{"name", NormalType}
{"identifier", NormalType}
{"version", NormalType}
{"sdk", NormalType}
{"description", NormalType}
{"development_region", NormalType}
{"native", IntType}
{"path", NormalType}
{"disabled", IntType}
}

auto const data = execute_query("select * from browser_plugins");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);

auto const datauser = execute_query("select * from browser_plugins where uid=0");
ASSERT_GE(datauser.size(), 1ul);
validate_rows(datauser, row_map);

ValidationMap row_map =
{ {"uid", IntType} {"name", NormalType} {"identifier", NormalType} {
"version", NormalType} {"sdk", NormalType} {"description", NormalType} {
"development_region", NormalType} {"native", IntType} {
"path", NormalType} {"disabled", IntType} }

auto const data = execute_query("select * from browser_plugins");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);

auto const datauser =
execute_query("select * from browser_plugins where uid=0");
ASSERT_GE(datauser.size(), 1ul);
validate_rows(datauser, row_map);
}

} // namespace table_tests
Expand Down
34 changes: 13 additions & 21 deletions tests/integration/tables/crashes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,20 @@ class crashes : public testing::Test {
};

TEST_F(crashes, test_sanity) {
ValidationMap row_map = {
{"type", NormalType}
{"pid", IntType}
{"path", NormalType}
{"crash_path", NormalType}
{"identifier", NormalType}
{"version", NormalType}
{"parent", IntType}
{"responsible", NormalType}
{"uid", IntType}
{"datetime", NormalType}
{"crashed_thread", IntType}
{"stack_trace", NormalType}
{"exception_type", NormalType}
{"exception_codes", NormalType}
{"exception_notes", NormalType}
{"registers", NormalType}
}
ValidationMap row_map =
{ {"type", NormalType} {"pid", IntType} {"path", NormalType} {
"crash_path", NormalType} {"identifier", NormalType} {
"version", NormalType} {"parent", IntType} {"responsible", NormalType} {
"uid", IntType} {"datetime", NormalType} {"crashed_thread", IntType} {
"stack_trace", NormalType} {"exception_type", NormalType} {
"exception_codes", NormalType} {"exception_notes", NormalType} {
"registers", NormalType} }

auto const data = execute_query("select users.username, crashes.* from users CROSS JOIN crashes USING(uid);");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);
auto const data = execute_query(
"select users.username, crashes.* from users CROSS JOIN crashes "
"USING(uid);");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);
}

} // namespace table_tests
Expand Down
13 changes: 5 additions & 8 deletions tests/integration/tables/ntfs_acl_permissions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ class ntfsAclPermissions : public testing::Test {
};

TEST_F(ntfsAclPermissions, test_sanity) {
ValidationMap row_map = {
{"path", NormalType}
{"type", NormalType}
{"principal", NormalType}
{"access", NormalType}
{"inherited_from", NormalType}
}
ValidationMap row_map =
{ {"path", NormalType} {"type", NormalType} {"principal", NormalType} {
"access", NormalType} {"inherited_from", NormalType} }

auto const data = execute_query("select * from ntfs_acl_permissions where path = '\'");
auto const data =
execute_query("select * from ntfs_acl_permissions where path = '\'");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);
}
Expand Down
31 changes: 14 additions & 17 deletions tests/integration/tables/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,20 @@ class preferences : public testing::Test {
};

TEST_F(preferences, test_sanity) {
ValidationMap row_map = {
{"domain", NormalType}
{"key", NormalType}
{"subkey", NormalType}
{"value", NormalType}
{"forced", IntType}
{"username", NormalType}
{"host", NormalType}
}

auto const data = execute_query("select * from preferences");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);

auto const datajoin = execute_query("select users.username, preferences.* from users CROSS JOIN preferences USING(username) where preferences.domain = 'com.apple.Preferences';");
ASSERT_GE(datajoin.size(), 1ul);
validate_rows(datajoin, row_map);
ValidationMap row_map =
{ {"domain", NormalType} {"key", NormalType} {"subkey", NormalType} {
"value", NormalType} {"forced", IntType} {"username", NormalType} {
"host", NormalType} }

auto const data = execute_query("select * from preferences");
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);

auto const datajoin = execute_query(
"select users.username, preferences.* from users CROSS JOIN preferences "
"USING(username) where preferences.domain = 'com.apple.Preferences';");
ASSERT_GE(datajoin.size(), 1ul);
validate_rows(datajoin, row_map);
}

} // namespace table_tests
Expand Down
20 changes: 6 additions & 14 deletions tests/integration/tables/process_open_sockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,12 @@ class processOpenSockets : public testing::Test {
};

TEST_F(processOpenSockets, test_sanity) {
ValidationMap row_map = {
{"pid", IntType}
{"fd", IntType}
{"socket", IntType}
{"family", IntType}
{"protocol", IntType}
{"local_address", NormalType}
{"remote_address", NormalType}
{"local_port", IntType}
{"remote_port", IntType}
{"path", NormalType}
{"state", NormalType}
{"net_namespace", NormalType}
}
ValidationMap row_map =
{ {"pid", IntType} {"fd", IntType} {"socket", IntType} {"family", IntType} {
"protocol", IntType} {"local_address", NormalType} {
"remote_address", NormalType} {"local_port", IntType} {
"remote_port", IntType} {"path", NormalType} {"state", NormalType} {
"net_namespace", NormalType} }

auto const data = execute_query("select * from process_open_sockets");
ASSERT_GE(data.size(), 1ul);
Expand Down
13 changes: 4 additions & 9 deletions tests/integration/tables/python_packages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ class pythonPackages : public testing::Test {
};

TEST_F(pythonPackages, test_sanity) {
ValidationMap row_map = {
{"name", NormalType}
{"version", NormalType}
{"summary", NormalType}
{"author", NormalType}
{"license", NormalType}
{"path", NormalType}
{"directory", NormalType}
}
ValidationMap row_map =
{ {"name", NormalType} {"version", NormalType} {"summary", NormalType} {
"author", NormalType} {"license", NormalType} {"path", NormalType} {
"directory", NormalType} }

auto const data = execute_query("select * from python_packages");
ASSERT_GE(data.size(), 1ul);
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/tables/routes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ TEST_F(RoutesTest, test_sanity) {
ASSERT_GE(data.size(), 1ul);
validate_rows(data, row_map);

auto const datatype = execute_query("select * from routes where type = 'local'");
auto const datatype =
execute_query("select * from routes where type = 'local'");
ASSERT_GE(datatype.size(), 1ul);
validate_rows(datatype, row_map);


}

} // namespace table_tests
Expand Down

0 comments on commit ee0d19c

Please sign in to comment.