Skip to content

Commit

Permalink
update: address review comments
Browse files Browse the repository at this point in the history
Co-authored-by: Federico Di Pierro <[email protected]>
Signed-off-by: Jason Dellaluce <[email protected]>
  • Loading branch information
2 people authored and poiana committed May 15, 2024
1 parent c9a433a commit 4c993d6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions userspace/libsinsp/test/plugins.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,11 @@ TEST_F(sinsp_with_test_input, plugin_subtables_array)
ASSERT_EQ(table->key_info(), libsinsp::state::typeinfo::of<int64_t>());
ASSERT_EQ(table->dynamic_fields()->fields().size(), 0);

auto field = table->static_fields()->find("env_vars");
auto field = table->static_fields()->find("env");
ASSERT_NE(field, table->static_fields()->end());
ASSERT_EQ(field->second.readonly(), true);
ASSERT_EQ(field->second.valid(), true);
ASSERT_EQ(field->second.name(), "env_vars");
ASSERT_EQ(field->second.name(), "env");
ASSERT_EQ(field->second.info(), libsinsp::state::typeinfo::of<libsinsp::state::base_table*>());

ASSERT_EQ(table->entries_count(), 0);
Expand All @@ -793,7 +793,7 @@ TEST_F(sinsp_with_test_input, plugin_subtables_array)
auto subtable = dynamic_cast<libsinsp::state::stl_container_table_adapter<std::vector<std::string>>*>(
entry->get_static_field(subtable_acc));
ASSERT_NE(subtable, nullptr);
ASSERT_EQ(subtable->name(), "env_vars");
ASSERT_EQ(subtable->name(), "env");
ASSERT_EQ(subtable->entries_count(), 0);

// get an accessor to a dynamic field representing the array's values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static ss_plugin_t* plugin_init(const ss_plugin_init_input* in, ss_plugin_rc* rc

// get an accessor to the file descriptor tables owned by each thread info
ret->table_field_envtable = in->tables->fields.get_table_field(
ret->thread_table, "env_vars", ss_plugin_state_type::SS_PLUGIN_ST_TABLE);
ret->thread_table, "env", ss_plugin_state_type::SS_PLUGIN_ST_TABLE);
if (!ret->table_field_envtable)
{
*rc = SS_PLUGIN_FAILURE;
Expand Down
6 changes: 3 additions & 3 deletions userspace/libsinsp/test/state.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,11 @@ TEST(thread_manager, env_vars_access)
EXPECT_EQ(table->key_info(), libsinsp::state::typeinfo::of<int64_t>());
EXPECT_EQ(table->dynamic_fields()->fields().size(), 0);

auto field = table->static_fields()->find("env_vars");
auto field = table->static_fields()->find("env");
ASSERT_NE(field, table->static_fields()->end());
EXPECT_EQ(field->second.readonly(), true);
EXPECT_EQ(field->second.valid(), true);
EXPECT_EQ(field->second.name(), "env_vars");
EXPECT_EQ(field->second.name(), "env");
EXPECT_EQ(field->second.info(), libsinsp::state::typeinfo::of<libsinsp::state::base_table*>());

ASSERT_EQ(table->entries_count(), 0);
Expand All @@ -577,7 +577,7 @@ TEST(thread_manager, env_vars_access)
auto subtable_acc = field->second.new_accessor<libsinsp::state::base_table*>();
auto subtable = dynamic_cast<libsinsp::state::stl_container_table_adapter<std::vector<std::string>>*>(entry->get_static_field(subtable_acc));
ASSERT_NE(subtable, nullptr);
EXPECT_EQ(subtable->name(), "env_vars");
EXPECT_EQ(subtable->name(), "env");
EXPECT_EQ(subtable->entries_count(), 0);
EXPECT_EQ(subtable->key_info(), libsinsp::state::typeinfo::of<uint64_t>());
EXPECT_EQ(subtable->static_fields()->size(), 0);
Expand Down
6 changes: 3 additions & 3 deletions userspace/libsinsp/threadinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ sinsp_threadinfo::sinsp_threadinfo(sinsp* inspector, std::shared_ptr<libsinsp::s
m_inspector(inspector),
m_fdtable(inspector),
m_args_table_adapter("args", m_args),
m_env_table_adapter("env_vars", m_env)
m_env_table_adapter("env", m_env)
{
init();
}
Expand All @@ -70,8 +70,8 @@ libsinsp::state::static_struct::field_infos sinsp_threadinfo::static_fields() co
define_static_field(ret, this, m_exe_writable, "exe_writable");
define_static_field(ret, this, m_exe_upper_layer, "exe_upper_layer");
define_static_field(ret, this, m_exe_from_memfd, "exe_from_memfd");
define_static_field(ret, this, m_env_table_adapter.table_ptr(), "args", true);
define_static_field(ret, this, m_env_table_adapter.table_ptr(), "env_vars", true);
define_static_field(ret, this, m_args_table_adapter.table_ptr(), "args", true);
define_static_field(ret, this, m_env_table_adapter.table_ptr(), "env", true);
// m_cgroups
define_static_field(ret, this, m_container_id, "container_id");
define_static_field(ret, this, m_flags, "flags");
Expand Down

0 comments on commit 4c993d6

Please sign in to comment.