mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +01:00
[AC-1882] Fixed Brittle SM Unit Tests (#3510)
* Resolved brittle test failures for UpdateSubscriptionAsync_ValidInput_WithNullMaxAutoscale_Passes * Resolved brittle test failures for UpdateSubscriptionAsync_UpdateSeatsToAutoscaleLimit_EmailsOwners * Resolved brittle test failures for UpdateSubscriptionAsync_ThrowsBadRequestException_WhenMaxAutoscaleSeatsBelowSeatCount * Resolved brittle test UpdateSubscriptionAsync_ServiceAccountsGreaterThanMaxAutoscaleSeats_ThrowsException * Resolved brittle test UpdateSubscriptionAsync_ServiceAccountsLessThanPlanMinimum_ThrowsException * Resolved flaky test UpdateSubscriptionAsync_SeatsAdjustmentGreaterThanMaxAutoscaleSeats_ThrowsException
This commit is contained in:
parent
21f91b7043
commit
3b80791aa8
@ -98,6 +98,10 @@ public class UpdateSecretsManagerSubscriptionCommandTests
|
||||
|
||||
const int updateSmSeats = 15;
|
||||
const int updateSmServiceAccounts = 450;
|
||||
|
||||
// Ensure that SmSeats is different from the original organization.SmSeats
|
||||
organization.SmSeats = updateSmSeats + 5;
|
||||
|
||||
var update = new SecretsManagerSubscriptionUpdate(organization, false)
|
||||
{
|
||||
SmSeats = updateSmSeats,
|
||||
@ -299,10 +303,15 @@ public class UpdateSecretsManagerSubscriptionCommandTests
|
||||
Organization organization,
|
||||
SutProvider<UpdateSecretsManagerSubscriptionCommand> sutProvider)
|
||||
{
|
||||
const int seatCount = 10;
|
||||
|
||||
// Make sure Password Manager seats is greater or equal to Secrets Manager seats
|
||||
organization.Seats = seatCount;
|
||||
|
||||
var update = new SecretsManagerSubscriptionUpdate(organization, false)
|
||||
{
|
||||
SmSeats = 10,
|
||||
MaxAutoscaleSmSeats = 10
|
||||
SmSeats = seatCount,
|
||||
MaxAutoscaleSmSeats = seatCount
|
||||
};
|
||||
|
||||
await sutProvider.Sut.UpdateSubscriptionAsync(update);
|
||||
@ -380,8 +389,8 @@ public class UpdateSecretsManagerSubscriptionCommandTests
|
||||
{
|
||||
var update = new SecretsManagerSubscriptionUpdate(organization, false)
|
||||
{
|
||||
SmSeats = 15,
|
||||
MaxAutoscaleSmSeats = 10
|
||||
SmSeats = organization.SmSeats + 10,
|
||||
MaxAutoscaleSmSeats = organization.SmSeats + 5
|
||||
};
|
||||
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(
|
||||
@ -510,10 +519,16 @@ public class UpdateSecretsManagerSubscriptionCommandTests
|
||||
Organization organization,
|
||||
SutProvider<UpdateSecretsManagerSubscriptionCommand> sutProvider)
|
||||
{
|
||||
const int smServiceAccount = 15;
|
||||
const int maxAutoscaleSmServiceAccounts = 10;
|
||||
|
||||
organization.SmServiceAccounts = smServiceAccount - 5;
|
||||
organization.MaxAutoscaleSmServiceAccounts = 2 * smServiceAccount;
|
||||
|
||||
var update = new SecretsManagerSubscriptionUpdate(organization, false)
|
||||
{
|
||||
SmServiceAccounts = 15,
|
||||
MaxAutoscaleSmServiceAccounts = 10
|
||||
SmServiceAccounts = smServiceAccount,
|
||||
MaxAutoscaleSmServiceAccounts = maxAutoscaleSmServiceAccounts
|
||||
};
|
||||
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(
|
||||
@ -528,9 +543,13 @@ public class UpdateSecretsManagerSubscriptionCommandTests
|
||||
Organization organization,
|
||||
SutProvider<UpdateSecretsManagerSubscriptionCommand> sutProvider)
|
||||
{
|
||||
const int newSmServiceAccounts = 199;
|
||||
|
||||
organization.SmServiceAccounts = newSmServiceAccounts - 10;
|
||||
|
||||
var update = new SecretsManagerSubscriptionUpdate(organization, false)
|
||||
{
|
||||
SmServiceAccounts = 199,
|
||||
SmServiceAccounts = newSmServiceAccounts,
|
||||
};
|
||||
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(
|
||||
@ -578,10 +597,16 @@ public class UpdateSecretsManagerSubscriptionCommandTests
|
||||
Organization organization,
|
||||
SutProvider<UpdateSecretsManagerSubscriptionCommand> sutProvider)
|
||||
{
|
||||
const int smSeats = 10;
|
||||
const int maxAutoscaleSmSeats = 5;
|
||||
|
||||
organization.SmSeats = smSeats - 1;
|
||||
organization.MaxAutoscaleSmSeats = smSeats * 2;
|
||||
|
||||
var update = new SecretsManagerSubscriptionUpdate(organization, false)
|
||||
{
|
||||
SmSeats = 10,
|
||||
MaxAutoscaleSmSeats = 5
|
||||
SmSeats = smSeats,
|
||||
MaxAutoscaleSmSeats = maxAutoscaleSmSeats
|
||||
};
|
||||
|
||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() => sutProvider.Sut.UpdateSubscriptionAsync(update));
|
||||
|
Loading…
Reference in New Issue
Block a user