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

SARC-391 fix account matching & related sanity check #150

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

nurbal
Copy link
Collaborator

@nurbal nurbal commented Feb 10, 2025

This PR fix an old problem unnoticed since project start: the multiple entries for a given person in members_drac CSV file were not handled properly.
With this PR, if a user has several entries in the CSV, the following priority is applied:

  • the last entry with "activation_status"=="activated" is used if present
  • otherwise, the last entry is used

The function alerts.db_sanity_check.users_accounts.check_users_in_jobs(time_interval: Optional[timedelta] = timedelta(hours=24)) -> list[str] is added and can be used by the health monitor, for example. It returns the list of usernames not found in the users db collection, present in the jobs from the last time_interval.

@nurbal nurbal mentioned this pull request Feb 17, 2025
@nurbal nurbal marked this pull request as ready for review February 17, 2025 02:30
@nurbal nurbal changed the title fix account matching SARC-391 fix account matching Feb 18, 2025
@nurbal nurbal changed the title SARC-391 fix account matching SARC-391 fix account matching & related sanity check Feb 18, 2025
@nurbal nurbal requested a review from bouthilx February 18, 2025 15:39
@@ -163,28 +163,29 @@ def test_acquire_users(cli_main, patch_return_values, mock_file, captrace):

assert spans[1].name == "match_drac_to_mila_accounts"
assert spans[1].status.status_code == StatusCode.OK
assert len(spans[1].events) == 9
Copy link
Member

Choose a reason for hiding this comment

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

Il faudrait ajouter un test qui vérifie le genre de problème corrigé dans cette PR.

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.

2 participants