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

Commit

Permalink
Remove test for using multiple investment disbursements as disburseme…
Browse files Browse the repository at this point in the history
…nts are now handled as multiple investments (#350)
  • Loading branch information
Comeani authored Oct 11, 2023
1 parent 886f355 commit b35ef36
Showing 1 changed file with 0 additions and 34 deletions.
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 b35ef36

Please sign in to comment.