DeviceEdgeTest.testSendOutdatedAttributeToCloud - improved stability for concurrent issue

This commit is contained in:
Volodymyr Babak 2025-01-31 18:24:50 +02:00
parent af4785d0e2
commit 3b8be75a14

View File

@ -500,6 +500,15 @@ public class DeviceEdgeTest extends AbstractEdgeTest {
attributesNode.put("test_attr", originalValue); attributesNode.put("test_attr", originalValue);
doPost("/api/plugins/telemetry/DEVICE/" + device.getId() + "/attributes/SERVER_SCOPE", attributesNode); doPost("/api/plugins/telemetry/DEVICE/" + device.getId() + "/attributes/SERVER_SCOPE", attributesNode);
// Wait before device attributes saved to database
Awaitility.await()
.atMost(10, TimeUnit.SECONDS)
.until(() -> {
String urlTemplate = "/api/plugins/telemetry/DEVICE/" + device.getId() + "/keys/attributes/" + DataConstants.SERVER_SCOPE;
List<String> actualKeys = doGetAsyncTyped(urlTemplate, new TypeReference<>() {});
return actualKeys != null && !actualKeys.isEmpty() && actualKeys.contains("test_attr");
});
JsonObject attributesData = new JsonObject(); JsonObject attributesData = new JsonObject();
// incorrect msg, will not be saved, because of ts is lower than for already existing // incorrect msg, will not be saved, because of ts is lower than for already existing
String attributesKey = "test_attr"; String attributesKey = "test_attr";