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: metrics test is independent from execution of unrelated tests #14422

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

nstng
Copy link
Contributor

@nstng nstng commented Nov 11, 2022

Signed-off-by: Nils Semmelrock nils.semmelrock@tngtech.com

Summary

#14351 moved test_gateway_metrics_attach_detach.py in the execution order. This made an early assert fail because no mme_new_association event happened yet (see, e.g., https://github.com/magma/magma/runs/9277319986). Another attach/detach test needs to be executed firs, e.g., test_attach_detach.py if mme was restarted in the mean time.

Here: move the assert to the end of the test and check that the event counter actually increased during the test - dynamically so that possible events from other tests do not matter.

Test Plan

Execute test_gateway_metrics_attach_detach.py after a freshly restarted mme.

Additional Information

  • This change is backwards-breaking

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
@nstng nstng requested review from a team and rsarwad November 11, 2022 11:52
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines. label Nov 11, 2022
@github-actions
Copy link
Contributor

Thanks for opening a PR! 💯

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

@github-actions github-actions bot added the component: agw Access gateway-related issue label Nov 11, 2022
@nstng nstng added the LTE-Integration-Test Issues relating to LTE Integration Tests label Nov 11, 2022
Copy link
Contributor

@crasu crasu left a comment

Choose a reason for hiding this comment

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

A description in the pr instead of TBD be nice

"mme_new_association",
label_values_success,
)
assert (mme_new_association == mme_new_association_before + 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this counter measure? I would have assumed that this value is 2 after the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not completely sure ... I started my local test with +2, but it seems to be +1. The doc says "New SCTP association". I.e., maybe something like a session based counter.

Copy link
Contributor

@crasu crasu Nov 11, 2022

Choose a reason for hiding this comment

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

If these are sctp association 1 makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, on new sctp association, for label "mme_new_association" count gets incremented.

@crasu crasu self-requested a review November 11, 2022 12:01
@nstng nstng merged commit 3bfe00e into magma:master Nov 11, 2022
@@ -39,11 +39,10 @@ def test_gateway_metrics_attach_detach(self):
""" Basic gateway metrics with attach/detach for a single UE """

label_values_success = {"result": "success"}
mme_new_association = self._getMetricValueGivenLabel(
mme_new_association_before = self._getMetricValueGivenLabel(
Copy link
Contributor

Choose a reason for hiding this comment

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

For every test case, new sctp association is created as part Setup() and every test case has Teardown() when test cases exits. In TearDown(), s1ap tester sends sctp shutdown which eventually clears the association. As part of mme restart, is connection closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rsarwad aww sorry, I already mergede the PR - do you see an issue with this? Then I will create a new PR.
My observation was that the metric counter remained after test_attach_detach.py was executed and test_gateway_metrics_attach_detach actually expected this by an assert counter > 0. I.e., I would expect that test_attach_detach.py does not clean up the counter correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like counter for label "mme_new_association" is not getting decremented on sctp shutdown at mme. Changes in PR make sure that only one association is created before test case terminates

lucasgonze pushed a commit to lucasgonze/magma that referenced this pull request Feb 29, 2024
…agma#14422)

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>

Signed-off-by: Nils Semmelrock <nils.semmelrock@tngtech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: agw Access gateway-related issue LTE-Integration-Test Issues relating to LTE Integration Tests size/XS Denotes a PR that changes 0-9 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants