Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(libsinsp/test): use correct iterator type in plugin tests #1987

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading