Skip to content

Commit

Permalink
fix(libsinsp/test): use correct iterator type in plugin tests
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra committed Aug 1, 2024
1 parent 3ce0a2d commit ed9a53d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions userspace/libsinsp/test/plugins.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ TEST_F(sinsp_with_test_input, plugin_subtables)

// get an accessor to a dynamic field declared by the plugin
ASSERT_EQ(subtable->dynamic_fields()->fields().size(), 1);
const auto& dfield = subtable->dynamic_fields()->fields().find("custom");
ASSERT_NE(dfield, table->dynamic_fields()->fields().end());
auto dfield = subtable->dynamic_fields()->fields().find("custom");
ASSERT_NE(dfield, subtable->dynamic_fields()->fields().end());
auto dfieldacc = dfield->second.new_accessor<std::string>();

// start the event capture
Expand Down Expand Up @@ -792,8 +792,8 @@ TEST_F(sinsp_with_test_input, plugin_subtables_array)

// get an accessor to a dynamic field representing the array's values
ASSERT_EQ(subtable->dynamic_fields()->fields().size(), 1);
const auto& dfield = subtable->dynamic_fields()->fields().find("value");
ASSERT_NE(dfield, table->dynamic_fields()->fields().end());
auto dfield = subtable->dynamic_fields()->fields().find("value");
ASSERT_NE(dfield, subtable->dynamic_fields()->fields().end());
ASSERT_EQ(dfield->second.readonly(), false);
ASSERT_EQ(dfield->second.valid(), true);
ASSERT_EQ(dfield->second.name(), "value");
Expand Down
4 changes: 2 additions & 2 deletions userspace/libsinsp/test/state.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,11 @@ TEST(thread_manager, fdtable_access)

//checking if the new field has been added
ASSERT_EQ(subtable->dynamic_fields()->fields().size(), 1);
ASSERT_NE(subtable->dynamic_fields()->fields().find("str_val"), table->dynamic_fields()->fields().end());
ASSERT_NE(subtable->dynamic_fields()->fields().find("str_val"), subtable->dynamic_fields()->fields().end());

//checking if the new field has been added to the other subtable
ASSERT_EQ(subtable2->dynamic_fields()->fields().size(), 1);
ASSERT_NE(subtable2->dynamic_fields()->fields().find("str_val"), table->dynamic_fields()->fields().end());
ASSERT_NE(subtable2->dynamic_fields()->fields().find("str_val"), subtable2->dynamic_fields()->fields().end());

auto sfieldacc = sfield->second.new_accessor<int64_t>();
auto dfieldacc = dfield.new_accessor<std::string>();
Expand Down

0 comments on commit ed9a53d

Please sign in to comment.