diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestCatalogRetireElements.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestCatalogRetireElements.java
index 0f3c7e1..965a5fb 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestCatalogRetireElements.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestCatalogRetireElements.java
@@ -53,8 +53,7 @@ public class TestCatalogRetireElements extends TestIntegrationBase {
return super.getConfigSource("/beatrixCatalogRetireElements.properties");
}
- // Flaky, see https://github.com/killbill/killbill/issues/860
- @Test(groups = "slow", retryAnalyzer = FlakyRetryAnalyzer.class)
+ @Test(groups = "slow")
public void testRetirePlan() throws Exception {
// Catalog v1 starts in 2011-01-01
// Catalog v2 starts in 2015-12-01
@@ -111,8 +110,7 @@ public class TestCatalogRetireElements extends TestIntegrationBase {
}
- // Flaky, see https://github.com/killbill/killbill/issues/860
- @Test(groups = "slow", retryAnalyzer = FlakyRetryAnalyzer.class)
+ @Test(groups = "slow")
public void testRetirePlanWithUncancel() throws Exception {
// Catalog v1 starts in 2011-01-01
// Catalog v2 starts in 2015-12-01
@@ -176,8 +174,7 @@ public class TestCatalogRetireElements extends TestIntegrationBase {
}
}
- // Flaky, see https://github.com/killbill/killbill/issues/860
- @Test(groups = "slow", retryAnalyzer = FlakyRetryAnalyzer.class)
+ @Test(groups = "slow")
public void testRetirePlanAfterChange() throws Exception {
// Catalog v1 starts in 2011-01-01
// Catalog v3 starts in 2016-01-01
diff --git a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java
index 4e8ecce..33fe5ab 100644
--- a/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java
+++ b/beatrix/src/test/java/org/killbill/billing/beatrix/integration/TestIntegrationBase.java
@@ -308,6 +308,11 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
public void beforeClass() throws Exception {
final InvoiceConfig defaultInvoiceConfig = new ConfigurationObjectFactory(skifeConfigSource).build(InvoiceConfig.class);
invoiceConfig = new ConfigurableInvoiceConfig(defaultInvoiceConfig);
+ // The default value is 50, i.e. wait 50 x 100ms = 5s to get the lock. This isn't always enough and can lead to random tests failures
+ // in the listener status: after moving the clock, if there are two notifications triggering an invoice run, we typically expect
+ // both an INVOICE and a NULL_INVOICE event. If the invoice generation takes too long, the NULL_INVOICE event is never generated
+ // (LockFailedException): the test itself doesn't fail (the correct invoice is generated), but assertListenerStatus() would.
+ invoiceConfig.setMaxGlobalLockRetries(150);
final Injector g = Guice.createInjector(Stage.PRODUCTION, new BeatrixIntegrationModule(configSource, invoiceConfig));
g.injectMembers(this);
}
@@ -973,10 +978,12 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
private final InvoiceConfig defaultInvoiceConfig;
+ private int maxGlobalLockRetries;
private boolean isInvoicingSystemEnabled;
public ConfigurableInvoiceConfig(final InvoiceConfig defaultInvoiceConfig) {
this.defaultInvoiceConfig = defaultInvoiceConfig;
+ maxGlobalLockRetries = defaultInvoiceConfig.getMaxGlobalLockRetries();
isInvoicingSystemEnabled = defaultInvoiceConfig.isInvoicingSystemEnabled();
}
@@ -1032,7 +1039,7 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
@Override
public int getMaxGlobalLockRetries() {
- return defaultInvoiceConfig.getMaxGlobalLockRetries();
+ return maxGlobalLockRetries;
}
@Override
@@ -1080,6 +1087,10 @@ public class TestIntegrationBase extends BeatrixTestSuiteWithEmbeddedDB implemen
return getItemResultBehaviorMode();
}
+ public void setMaxGlobalLockRetries(final int maxGlobalLockRetries) {
+ this.maxGlobalLockRetries = maxGlobalLockRetries;
+ }
+
public void setInvoicingSystemEnabled(final boolean invoicingSystemEnabled) {
isInvoicingSystemEnabled = invoicingSystemEnabled;
}