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

Adapted the existing checks to work with ascs_ers cluster #475

Merged
merged 2 commits into from
Jul 18, 2024

Conversation

ksanjeet
Copy link
Contributor

Adapted 3 community checks "6E9B82", "C620DC" and "D78671" to work with ascs_ers cluster. The existing checks had constant values for corosync configurations "two_node" and "expected_vote" which in this adaptation is changed to use conditional checks and depends upon how many nodes are configured in corosync and cib.

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 95.056%. remained the same
when pulling 963dcba on ksanjeet:existing-modified-for-ascs
into 3f76618 on trento-project:main.

@arbulu89 arbulu89 self-requested a review June 26, 2024 13:11
Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

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

Really good job @ksanjeet
Just a couple of comments.

  • Add a else statement returning fale
  • Add new lines, it is easier to read
    I will merge once you apply those 2 things

expect: facts.corosync_twonode == values.expected_twonode
failure_message: Corosync 'two_node' value was expected to be '${values.expected_twonode}' but configured value is '${facts.corosync_twonode}'
expect: |
if facts.corosync_num_nodes.len == 2 { facts.corosync_twonode == values.expected_twonode } else if facts.corosync_num_nodes.len >= 3 { facts.corosync_twonode == values.expected_threeormore }
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @ksanjeet
Here we have a blank sport if for some reason the num of nodes is 1.
Maybe we should add this condition and return false, in the final else statement.
I know it is a corner case, but i don't know how our engine would behave if we don't return a boolean. Most probably the check would fail with a unknown reason.

expect: facts.runtime_two_node == values.expected_runtime_two_node
failure_message: Corosync 'two_node' value was expected to be '${values.expected_runtime_two_node}' but value of running config is '${facts.runtime_two_node}'
expect: |
if facts.corosync_num_nodes.len == 2 { facts.runtime_two_node == values.expected_runtime_two_node } else if facts.corosync_num_nodes.len >= 3 { facts.runtime_two_node == values.expected_runtime_threeormore }
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a final else here as well.
By the way, the code would looks easier to read if you add some new lines. To look like:

if facts.corosync_num_nodes.len == 2 {
  facts.runtime_two_node == values.expected_runtime_two_node
} else if facts.corosync_num_nodes.len >= 3 {
  facts.runtime_two_node == values.expected_runtime_threeormore
} else {
  false
}

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 95.034% (-0.02%) from 95.056%
when pulling 60a0b9c on ksanjeet:existing-modified-for-ascs
into 3f76618 on trento-project:main.

@arbulu89
Copy link
Contributor

arbulu89 commented Jul 18, 2024

Thank you @ksanjeet
LGTM
Ready to merge, right?

@ksanjeet
Copy link
Contributor Author

Yes, please.

@arbulu89 arbulu89 added the enhancement New feature or request label Jul 18, 2024
@arbulu89 arbulu89 merged commit 535989f into trento-project:main Jul 18, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants