Remove build server specific timing from dynamodb and ruuvigateway (#15472)
* Remove build server specific timing from dynamodb and ruuvigateway There should be no difference between running tests on your own PC or on a build server. The ruuvigateway tests always fail for me during parallel builds due to its unrealistic timing. Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -96,26 +96,13 @@ public class BaseIntegrationTest extends JavaTest {
|
||||
static {
|
||||
ComponentContext context = Mockito.mock(ComponentContext.class);
|
||||
BundleContext bundleContext = Mockito.mock(BundleContext.class);
|
||||
Hashtable<String, Object> properties = new Hashtable<String, Object>();
|
||||
Hashtable<String, Object> properties = new Hashtable<>();
|
||||
properties.put("measurementSystem", SIUnits.MEASUREMENT_SYSTEM_NAME);
|
||||
when(context.getProperties()).thenReturn(properties);
|
||||
when(context.getBundleContext()).thenReturn(bundleContext);
|
||||
UNIT_PROVIDER = new I18nProviderImpl(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether tests are run in Continuous Integration environment, i.e. Jenkins or Travis CI
|
||||
*
|
||||
* Travis CI is detected using CI environment variable, see https://docs.travis-ci.com/user/environment-variables/
|
||||
* Jenkins CI is detected using JENKINS_HOME environment variable
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected static boolean isRunningInCI() {
|
||||
String jenkinsHome = System.getenv("JENKINS_HOME");
|
||||
return "true".equals(System.getenv("CI")) || (jenkinsHome != null && !jenkinsHome.isBlank());
|
||||
}
|
||||
|
||||
private static boolean credentialsSet() {
|
||||
String access = System.getProperty("DYNAMODBTEST_ACCESS");
|
||||
String secret = System.getProperty("DYNAMODBTEST_SECRET");
|
||||
@@ -135,10 +122,9 @@ public class BaseIntegrationTest extends JavaTest {
|
||||
|
||||
@Override
|
||||
protected void waitForAssert(Runnable runnable) {
|
||||
// Longer timeouts and slower polling with real dynamodb
|
||||
// Non-CI tests against local server are with lower timeout.
|
||||
waitForAssert(runnable, hasFakeServer() ? isRunningInCI() ? 30_000L : 10_000L : 120_000L,
|
||||
hasFakeServer() ? 500 : 1000L);
|
||||
// Use longer timeouts and slower polling with real dynamodb when credentials are set.
|
||||
// Otherwise, test against a local server with lower timeouts.
|
||||
waitForAssert(runnable, hasFakeServer() ? 30_000L : 120_000L, hasFakeServer() ? 500 : 1000L);
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
package org.openhab.persistence.dynamodb.internal;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assumptions.*;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@@ -305,8 +305,6 @@ public class TestComplexItemsWithDifferentStateTypesTest extends BaseIntegration
|
||||
|
||||
@Test
|
||||
public void testGroupDummyItem() {
|
||||
// Do not want to slow down CI runs
|
||||
assumeFalse(isRunningInCI());
|
||||
// only with the fast local server
|
||||
assumeTrue(hasFakeServer());
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user