-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix: Wrong date printed when lease started and spend calculated a…
…re on the same day. (#358) * Bug fix: Wrong date printed when lease started and spend calculated are on the same day. * Revert "Bug fix: Wrong date printed when lease started and spend calculated are on the same day." This reverts commit e294228. * Bug fix: Wrong date printed when lease started and spend calculated are on the same day. Co-authored-by: Jaya Nanda <[email protected]>
- Loading branch information
1 parent
f909c25
commit 030c87e
Showing
2 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,7 @@ has exceeded its budget of $100. Actual spend is $150 | |
expectedEmailBodyHTML string | ||
expectedEmailBodyText string | ||
expectedError string | ||
LeaseStatusModifiedOn int64 | ||
} | ||
|
||
checkBudgetTest := func(test *checkBudgetTestInput) { | ||
|
@@ -97,7 +98,7 @@ has exceeded its budget of $100. Actual spend is $150 | |
BudgetAmount: test.budgetAmount, | ||
BudgetCurrency: "USD", | ||
BudgetNotificationEmails: []string{"[email protected]", "[email protected]"}, | ||
LeaseStatusModifiedOn: time.Unix(100, 0).Unix(), | ||
LeaseStatusModifiedOn: map[bool]int64{true: time.Unix(100, 0).Unix(), false: test.LeaseStatusModifiedOn}[test.LeaseStatusModifiedOn == 0], | ||
ExpiresOn: time.Now().AddDate(0, 0, +1000).Unix(), //Make sure it expires in the distant future as we aren't testing that | ||
}, | ||
awsSession: &awsMocks.AwsSession{}, | ||
|
@@ -302,6 +303,21 @@ Actual spend is $76 | |
}) | ||
|
||
}) | ||
|
||
t.Run("Scenario: Under budget Lease: Lease started and spend calculated the same day", func(t *testing.T) { | ||
checkBudgetTest(&checkBudgetTestInput{ | ||
budgetAmount: 100, | ||
actualSpend: 50, | ||
leaseStatus: db.Active, | ||
// Should not finance lock or reset | ||
shouldTransitionLeaseStatus: false, | ||
shouldSNS: false, | ||
shouldSQSReset: false, | ||
// Should not send notification email | ||
shouldSendEmail: false, | ||
LeaseStatusModifiedOn: time.Now().Unix(), | ||
}) | ||
}) | ||
} | ||
func Test_isLeaseExpired(t *testing.T) { | ||
type args struct { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters