edge tests stability: seq_id column - remove maxvalue. increased timeout for waiting on edge imitator respones

This commit is contained in:
Volodymyr Babak 2023-09-15 16:39:58 +03:00
parent b224d8a00a
commit 16e3a6e177
12 changed files with 16 additions and 16 deletions

View File

@ -96,7 +96,7 @@ public class AssetEdgeTest extends AbstractEdgeTest {
edgeImitator.expectMessageAmount(1);
doDelete("/api/asset/" + savedAsset.getUuidId())
.andExpect(status().isOk());
Assert.assertTrue(edgeImitator.waitForMessages(1));
Assert.assertTrue(edgeImitator.waitForMessages(5));
// create asset #2 and assign to edge
edgeImitator.expectMessageAmount(2);
@ -262,9 +262,9 @@ public class AssetEdgeTest extends AbstractEdgeTest {
private Asset saveAssetOnCloudAndVerifyDeliveryToEdge() throws Exception {
// create asset and assign to edge
Asset savedAsset = saveAsset(StringUtils.randomAlphanumeric(15));
edgeImitator.expectMessageAmount(1); // asset message
edgeImitator.expectMessageAmount(2); // asset and asset profile messages
doPost("/api/edge/" + edge.getUuidId()
+ "/asset/" + savedAsset.getUuidId(), Device.class);
+ "/asset/" + savedAsset.getUuidId(), Asset.class);
Assert.assertTrue(edgeImitator.waitForMessages());
Optional<AssetUpdateMsg> assetUpdateMsgOpt = edgeImitator.findMessageByType(AssetUpdateMsg.class);
Assert.assertTrue(assetUpdateMsgOpt.isPresent());

View File

@ -42,7 +42,7 @@ public class CustomerEdgeTest extends AbstractEdgeTest {
Customer customer = new Customer();
customer.setTitle("Edge Customer");
Customer savedCustomer = doPost("/api/customer", customer, Customer.class);
Assert.assertFalse(edgeImitator.waitForMessages(1));
Assert.assertFalse(edgeImitator.waitForMessages(5));
// assign edge to customer
edgeImitator.expectMessageAmount(2);

View File

@ -99,7 +99,7 @@ public class DashboardEdgeTest extends AbstractEdgeTest {
edgeImitator.expectMessageAmount(1);
doDelete("/api/dashboard/" + savedDashboard.getUuidId())
.andExpect(status().isOk());
Assert.assertTrue(edgeImitator.waitForMessages(1));
Assert.assertTrue(edgeImitator.waitForMessages(5));
// create dashboard #2 and assign to edge
edgeImitator.expectMessageAmount(1);

View File

@ -106,7 +106,7 @@ public class DeviceEdgeTest extends AbstractEdgeTest {
edgeImitator.expectMessageAmount(1);
doDelete("/api/device/" + savedDevice.getUuidId())
.andExpect(status().isOk());
Assert.assertTrue(edgeImitator.waitForMessages(1));
Assert.assertTrue(edgeImitator.waitForMessages(5));
// create device #2 and assign to edge
edgeImitator.expectMessageAmount(2);

View File

@ -39,7 +39,7 @@ public class EdgeTest extends AbstractEdgeTest {
Customer customer = new Customer();
customer.setTitle("Edge Customer");
Customer savedCustomer = doPost("/api/customer", customer, Customer.class);
Assert.assertFalse(edgeImitator.waitForMessages(1));
Assert.assertFalse(edgeImitator.waitForMessages(5));
// assign edge to customer
edgeImitator.expectMessageAmount(2);

View File

@ -105,7 +105,7 @@ public class EntityViewEdgeTest extends AbstractEdgeTest {
edgeImitator.expectMessageAmount(1);
doDelete("/api/entityView/" + savedEntityView.getUuidId())
.andExpect(status().isOk());
Assert.assertTrue(edgeImitator.waitForMessages(1));
Assert.assertTrue(edgeImitator.waitForMessages(5));
// create entity view #2 and assign to edge
edgeImitator.expectMessageAmount(1);

View File

@ -229,6 +229,6 @@ public class RuleChainEdgeTest extends AbstractEdgeTest {
edgeImitator.expectMessageAmount(1);
doDelete("/api/ruleChain/" + savedRuleChain.getUuidId())
.andExpect(status().isOk());
Assert.assertTrue(edgeImitator.waitForMessages(1));
Assert.assertTrue(edgeImitator.waitForMessages(5));
}
}

View File

@ -22,6 +22,7 @@ import com.google.protobuf.AbstractMessage;
import org.awaitility.Awaitility;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.test.context.TestPropertySource;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.server.common.data.DataConstants;
import org.thingsboard.server.common.data.Device;
@ -41,6 +42,9 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
@DaoSqlTest
@TestPropertySource(properties = {
"edges.storage.sleep_between_batches=1000"
})
public class TelemetryEdgeTest extends AbstractEdgeTest {
@Test

View File

@ -120,7 +120,7 @@ public class UserEdgeTest extends AbstractEdgeTest {
Customer customer = new Customer();
customer.setTitle("Edge Customer");
Customer savedCustomer = doPost("/api/customer", customer, Customer.class);
Assert.assertFalse(edgeImitator.waitForMessages(1));
Assert.assertFalse(edgeImitator.waitForMessages(5));
// assign edge to customer
edgeImitator.expectMessageAmount(2);

View File

@ -173,6 +173,7 @@ public class EdgeImitator {
}
private ListenableFuture<List<Void>> processDownlinkMsg(DownlinkMsg downlinkMsg) {
log.trace("processDownlinkMsg: {}", downlinkMsg);
List<ListenableFuture<Void>> result = new ArrayList<>();
if (downlinkMsg.getAdminSettingsUpdateMsgCount() > 0) {
for (AdminSettingsUpdateMsg adminSettingsUpdateMsg : downlinkMsg.getAdminSettingsUpdateMsgList()) {

View File

@ -11,8 +11,6 @@ transport.lwm2m.security.trust-credentials.keystore.store_file=lwm2m/credentials
# Edge disabled to speed up the context init. Will be enabled by @TestPropertySource in respective tests
edges.enabled=false
edges.storage.no_read_records_sleep=500
edges.storage.sleep_between_batches=500
actors.rpc.submit_strategy=BURST
queue.rule-engine.stats.enabled=true

View File

@ -1,5 +1,2 @@
--PostgreSQL specific truncate to fit constraints
TRUNCATE TABLE device_credentials, device, device_profile, asset, asset_profile, ota_package, rule_node_state, rule_node, rule_chain, alarm_comment, alarm, entity_alarm;
-- Decrease seq_id column to make sure to cover cases of new sequential cycle during the tests
ALTER SEQUENCE edge_event_seq_id_seq MAXVALUE 256;
TRUNCATE TABLE device_credentials, device, device_profile, asset, asset_profile, ota_package, rule_node_state, rule_node, rule_chain, alarm_comment, alarm, entity_alarm;