diff options
Diffstat (limited to 'controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java')
-rw-r--r-- | controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java index 187b8f932cf..c5c70998624 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/CloudTrialExpirerTest.java @@ -9,16 +9,15 @@ import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanId; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; -import com.yahoo.vespa.hosted.controller.integration.ZoneApiMock; import com.yahoo.vespa.hosted.controller.tenant.LastLoginInfo; import com.yahoo.vespa.hosted.controller.tenant.Tenant; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.time.Duration; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author ogronnesby @@ -30,63 +29,63 @@ public class CloudTrialExpirerTest { private final CloudTrialExpirer expirer = new CloudTrialExpirer(tester.controller(), Duration.ofMinutes(5)); @Test - public void expire_inactive_tenant() { + void expire_inactive_tenant() { registerTenant("trial-tenant", "trial", Duration.ofDays(14).plusMillis(1)); - expirer.maintain(); + assertEquals(1.0, expirer.maintain()); assertPlan("trial-tenant", "none"); } @Test - public void tombstone_inactive_none() { - registerTenant("none-tenant", "none", Duration.ofDays(365).plusMillis(1)); - expirer.maintain(); + void tombstone_inactive_none() { + registerTenant("none-tenant", "none", Duration.ofDays(183).plusMillis(1)); + assertEquals(1.0, expirer.maintain()); assertEquals(Tenant.Type.deleted, tester.controller().tenants().get(TenantName.from("none-tenant"), true).get().type()); } @Test - public void keep_inactive_nontrial_tenants() { + void keep_inactive_nontrial_tenants() { registerTenant("not-a-trial-tenant", "pay-as-you-go", Duration.ofDays(30)); - expirer.maintain(); + assertEquals(1.0, expirer.maintain()); assertPlan("not-a-trial-tenant", "pay-as-you-go"); } @Test - public void keep_active_trial_tenants() { + void keep_active_trial_tenants() { registerTenant("active-trial-tenant", "trial", Duration.ofHours(14).minusMillis(1)); - expirer.maintain(); + assertEquals(1.0, expirer.maintain()); assertPlan("active-trial-tenant", "trial"); } @Test - public void keep_inactive_exempt_tenants() { + void keep_inactive_exempt_tenants() { registerTenant("exempt-trial-tenant", "trial", Duration.ofDays(40)); ((InMemoryFlagSource) tester.controller().flagSource()).withListFlag(PermanentFlags.EXTENDED_TRIAL_TENANTS.id(), List.of("exempt-trial-tenant"), String.class); - expirer.maintain(); + assertEquals(1.0, expirer.maintain()); assertPlan("exempt-trial-tenant", "trial"); } @Test - public void keep_inactive_trial_tenants_with_deployments() { + void keep_inactive_trial_tenants_with_deployments() { registerTenant("with-deployments", "trial", Duration.ofDays(30)); registerDeployment("with-deployments", "my-app", "default"); - expirer.maintain(); + assertEquals(1.0, expirer.maintain()); assertPlan("with-deployments", "trial"); } @Test - public void delete_tenants_with_applications_with_no_deployments() { - registerTenant("with-apps", "trial", Duration.ofDays(366)); + void delete_tenants_with_applications_with_no_deployments() { + registerTenant("with-apps", "trial", Duration.ofDays(184)); tester.createApplication("with-apps", "app1", "instance1"); - expirer.maintain(); + assertEquals(1.0, expirer.maintain()); assertPlan("with-apps", "none"); - expirer.maintain(); + assertEquals(1.0, expirer.maintain()); assertTrue(tester.controller().tenants().get("with-apps").isEmpty()); } @Test - public void keep_tenants_without_applications_that_are_idle() { - registerTenant("active", "none", Duration.ofDays(364)); - expirer.maintain(); + void keep_tenants_without_applications_that_are_idle() { + registerTenant("active", "none", Duration.ofDays(182)); + assertEquals(1.0, expirer.maintain()); assertPlan("active", "none"); } |