Browse Source

Merge pull request #15165 from smatvienko-tb/fix/flaky-tenant-controller-test

Fix flaky TenantControllerTest teardown timeout
pull/15197/head
Viacheslav Klimov 7 months ago
committed by GitHub
parent
commit
187e580542
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java
  2. 1
      application/src/test/resources/application-test.properties

9
application/src/test/java/org/thingsboard/server/controller/AbstractWebTest.java

@ -405,6 +405,10 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
public void teardownWebTest() throws Exception { public void teardownWebTest() throws Exception {
log.debug("Executing web test teardown"); log.debug("Executing web test teardown");
// Drain any pending housekeeper work left by the test body (e.g., bulk tenant deletes)
// before proceeding with teardown deletions, to avoid 90s per-tenant wait timing out.
awaitHousekeeperDrained();
loginSysAdmin(); loginSysAdmin();
deleteTenant(tenantId); deleteTenant(tenantId);
deleteDifferentTenant(); deleteDifferentTenant();
@ -436,6 +440,11 @@ public abstract class AbstractWebTest extends AbstractInMemoryStorageTest {
.until(() -> storage.getLag("tb_housekeeper") == 0); .until(() -> storage.getLag("tb_housekeeper") == 0);
} }
protected void awaitHousekeeperDrained() {
Awaitility.await("housekeeper drained").atMost(5, TimeUnit.MINUTES).during(300, TimeUnit.MILLISECONDS)
.until(() -> storage.getLag("tb_housekeeper") == 0);
}
private List<Tenant> getAllTenants() throws Exception { private List<Tenant> getAllTenants() throws Exception {
List<Tenant> loadedTenants = new ArrayList<>(); List<Tenant> loadedTenants = new ArrayList<>();
PageLink pageLink = new PageLink(10); PageLink pageLink = new PageLink(10);

1
application/src/test/resources/application-test.properties

@ -44,6 +44,7 @@ queue.transport_api.response_poll_interval=5
queue.transport.poll_interval=5 queue.transport.poll_interval=5
queue.core.poll-interval=5 queue.core.poll-interval=5
queue.core.partitions=2 queue.core.partitions=2
queue.core.housekeeper.task-reprocessing-delay-ms=0
queue.rule-engine.poll-interval=5 queue.rule-engine.poll-interval=5
queue.rule-engine.stats.enabled=true queue.rule-engine.stats.enabled=true

Loading…
Cancel
Save