-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
82 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "SysdigService.h" | ||
#include "gmock/gmock.h" | ||
#include "gtest/gtest.h" | ||
|
||
namespace collector { | ||
|
||
TEST(SysdigServiceTest, FilterEvent) { | ||
std::unique_ptr<sinsp> inspector(new sinsp()); | ||
|
||
sinsp_threadinfo regular_process(inspector.get()); | ||
regular_process.m_exepath = "/bin/busybox"; | ||
regular_process.m_comm = "sleep"; | ||
|
||
sinsp_threadinfo runc_process(inspector.get()); | ||
runc_process.m_exepath = "runc"; | ||
runc_process.m_comm = "6"; | ||
|
||
sinsp_threadinfo proc_self_process(inspector.get()); | ||
proc_self_process.m_exepath = "/proc/self/exe"; | ||
proc_self_process.m_comm = "runc"; | ||
|
||
sinsp_threadinfo memfd_process(inspector.get()); | ||
memfd_process.m_exepath = "memfd:runc_cloned:/proc/self/exe"; | ||
memfd_process.m_comm = "6"; | ||
|
||
struct test_t { | ||
const sinsp_threadinfo* tinfo; | ||
bool expected; | ||
}; | ||
std::vector<test_t> tests{ | ||
{®ular_process, true}, | ||
{&runc_process, false}, | ||
{&proc_self_process, false}, | ||
{&memfd_process, false}, | ||
}; | ||
|
||
for (const auto& t : tests) { | ||
ASSERT_EQ(SysdigService::FilterEvent(t.tinfo), t.expected); | ||
} | ||
} | ||
|
||
} // namespace collector |