File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
userspace/libsinsp/test/filterchecks Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -23,25 +23,36 @@ TEST_F(sinsp_with_test_input, EVT_FILTER_is_open_create) {
23
23
24
24
open_inspector ();
25
25
26
+ std::string path = " /home/file.txt" ;
27
+ int64_t fd = 3 ;
28
+
26
29
// In the enter event we don't send the `PPM_O_F_CREATED`
27
30
sinsp_evt* evt = add_event_advance_ts (increasing_ts (),
28
31
1 ,
29
32
PPME_SYSCALL_OPEN_E,
30
33
3 ,
31
- sinsp_test_input::open_params::default_path ,
34
+ path. c_str () ,
32
35
(uint32_t )PPM_O_RDWR | PPM_O_CREAT,
33
36
(uint32_t )0 );
34
37
ASSERT_EQ (get_field_as_string (evt, " evt.is_open_create" ), " false" );
35
38
36
39
// The `fdinfo` is not populated in the enter event
37
40
ASSERT_FALSE (evt->get_fd_info ());
38
41
39
- uint32_t flags = PPM_O_RDWR | PPM_O_CREAT | PPM_O_F_CREATED;
40
- evt = generate_open_x_event (sinsp_test_input::open_params{.flags = flags});
42
+ evt = add_event_advance_ts (increasing_ts (),
43
+ 1 ,
44
+ PPME_SYSCALL_OPEN_X,
45
+ 6 ,
46
+ fd,
47
+ path.c_str (),
48
+ (uint32_t )PPM_O_RDWR | PPM_O_CREAT | PPM_O_F_CREATED,
49
+ (uint32_t )0 ,
50
+ (uint32_t )5 ,
51
+ (uint64_t )123 );
41
52
ASSERT_EQ (get_field_as_string (evt, " evt.is_open_create" ), " true" );
42
53
ASSERT_TRUE (evt->get_fd_info ());
43
54
44
- ASSERT_EQ (evt->get_fd_info ()->m_openflags , flags );
55
+ ASSERT_EQ (evt->get_fd_info ()->m_openflags , PPM_O_RDWR | PPM_O_CREAT | PPM_O_F_CREATED );
45
56
}
46
57
47
58
TEST_F (sinsp_with_test_input, EVT_FILTER_is_lower_layer) {
You can’t perform that action at this time.
0 commit comments