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

Add tests against missing fields in prmon txt and json outputs #205

Merged
merged 2 commits into from
Oct 7, 2021

Conversation

quantum-shift
Copy link
Collaborator

@quantum-shift quantum-shift commented Sep 22, 2021

test_fields.cpp is added which runs prmon and parses the prmon.txt and prmon.json_snapshot files, and checks that the expected fields are present. It takes options --disable mon similar to prmon which allows testing of fields when certain monitors are disabled.

A function is added to the monitors which returns the parameter list for the monitor. This is used to get the parameters for each monitor.

Closes #152.

Copy link
Member

@graeme-a-stewart graeme-a-stewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @quantum-shift. I have one suggestion that makes get_all_registered() easier to understand (at least for me).

@@ -174,4 +174,14 @@ void snip_string_and_test(char *env_string, unsigned start, unsigned pos,
disabled_monitors.push_back(monitor_name);
}

const std::vector<std::string> get_all_registered() {
auto registered_monitors = registry::Registry<Imonitor>::list_registered();
for (const auto &monitor :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this block of code as it's so asymetric. How about getting the second monitor list and using insert, like this:

// Return all registered monitors, regardless of template type
// In practice this means combining monitors with no constructor
// arguments with those (=netmon) which take a list of strings
const std::vector<std::string> get_all_registered() {
  // Standard monitors
  auto registered_monitors = registry::Registry<Imonitor>::list_registered();
  // Special monitors
  auto special_monitors =
      registry::Registry<Imonitor, std::vector<std::string>>::list_registered();
  // Merge
  registered_monitors.insert(registered_monitors.end(),
                             special_monitors.begin(), special_monitors.end());
  return registered_monitors;
}

@graeme-a-stewart graeme-a-stewart merged commit 6f78b24 into HSF:main Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test against expected output fields
2 participants