Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into dependabot/pip/sqlalchemy-2.0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeani authored Oct 12, 2023
2 parents 36159c4 + e03ee89 commit e983944
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ sphinx = "<7.0.0"
sphinx-argparse = "0.4.0"
sphinx_autodoc_typehints = "1.23.0"
sphinx-copybutton = "0.5.2"
sphinx-rtd-theme = "1.2.2"
sphinx-rtd-theme = "1.3.0"
34 changes: 0 additions & 34 deletions tests/account_logic/test_AccountServices.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,40 +455,6 @@ def test_status_unlocked_with_investment_sus_applied(self) -> None:

self.assertEqual(900, investment.current_sus)

@patch.object(SlurmAccount,
"get_cluster_usage_per_user",
lambda self, cluster, start, end, in_hours: {'account1': 550, 'account2': 550})
def test_status_unlocked_with_multiple_investments_disbursements_applied(self) -> None:
"""Test that update_status uses investment SUs to cover usage over limits, exhausting the first investment
and withdrawing from a future disbursement of the investment"""

self.slurm_account.set_locked_state(False, cluster=settings.test_cluster)

with DBConnection.session() as session:
# Proposal is expired
proposal = session.execute(active_proposal_query).scalars().first()
proposal.allocations[0].service_units_total = 10_000
proposal.allocations[0].service_units_used = 35_000

# Investment is expired
investment = session.execute(active_investment_query).scalars().first()
investment.current_sus = 1000
investment.withdrawn_sus = 1000
investment.service_units = 2000

session.commit()

self.account.update_status()

# cluster should be unlocked due to exceeding usage being covered by investment
self.assertFalse(self.slurm_account.get_locked_state(cluster=settings.test_cluster))

with DBConnection.session() as session:
# check that investment SUs were used to cover usage
investment = session.execute(active_investment_query).scalars().first()

self.assertEqual(900, investment.current_sus)
self.assertEqual(investment.withdrawn_sus, investment.service_units)

@patch.object(SlurmAccount,
"get_cluster_usage_per_user",
Expand Down

0 comments on commit e983944

Please sign in to comment.