Skip to content

Commit a1690f5

Browse files
2nd attempt to fix random EEM and EPM CI failures (#34476)
* Revert "Attempt to reduce CI failures by increasing timeout in checking fake readings have changed." This reverts commit 42d36e9. * Added fixed random seed to try to avoid CI failures when looking for different values between two readings. There is a high probability that 2 energy readings could be the same, so using a fixed seed should mean that tests are at least reproducible. * Restyled by whitespace * Improved comment * Moved the change previously made in EVSManufacturerImpl to FakeReadings.cpp after updating to master. * Restyled by whitespace --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent f4d9188 commit a1690f5

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

examples/energy-management-app/energy-management-common/src/FakeReadings.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ void FakeReadings::StartFakeReadings(EndpointId aEndpointId, int64_t aPower_mW,
9393

9494
if (bReset)
9595
{
96+
// Use a fixed random seed to try to avoid random CI test failures
97+
// which are caused when the test is checking for 2 different numbers.
98+
// This is statistically more likely when the test runs for a long time
99+
// or if the seed is not set
100+
srand(1);
101+
96102
mTotalEnergyImported = 0;
97103
mTotalEnergyExported = 0;
98104
}

src/python_testing/TC_EEM_2_2.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def steps_TC_EEM_2_2(self) -> list[TestStep]:
5353
TestStep("4", "Wait 3 seconds"),
5454
TestStep("4a", "TH reads from the DUT the CumulativeEnergyImported attribute",
5555
"Verify the read is successful and note the value read."),
56-
TestStep("5", "Wait 5 seconds"),
56+
TestStep("5", "Wait 3 seconds"),
5757
TestStep("5a", "TH reads from the DUT the CumulativeEnergyImported attribute",
5858
"Verify the read is successful and that the value is greater than the value measured in step 4a."),
5959
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
@@ -80,7 +80,7 @@ async def test_TC_EEM_2_2(self):
8080
cumulative_energy_imported = await self.read_eem_attribute_expect_success("CumulativeEnergyImported")
8181

8282
self.step("5")
83-
time.sleep(5)
83+
time.sleep(3)
8484

8585
self.step("5a")
8686
cumulative_energy_imported_2 = await self.read_eem_attribute_expect_success("CumulativeEnergyImported")

src/python_testing/TC_EEM_2_3.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def steps_TC_EEM_2_3(self) -> list[TestStep]:
5353
TestStep("4", "Wait 6 seconds"),
5454
TestStep("4a", "TH reads from the DUT the CumulativeEnergyExported attribute",
5555
"Verify the read is successful and note the value read."),
56-
TestStep("5", "Wait 11 seconds"),
56+
TestStep("5", "Wait 6 seconds"),
5757
TestStep("5a", "TH reads from the DUT the CumulativeEnergyExported attribute",
5858
"Verify the read is successful and that the value is greater than the value measured in step 4a."),
5959
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
@@ -80,7 +80,7 @@ async def test_TC_EEM_2_3(self):
8080
cumulative_energy_exported = await self.read_eem_attribute_expect_success("CumulativeEnergyExported")
8181

8282
self.step("5")
83-
time.sleep(11)
83+
time.sleep(6)
8484

8585
self.step("5a")
8686
cumulative_energy_exported_2 = await self.read_eem_attribute_expect_success("CumulativeEnergyExported")

src/python_testing/TC_EEM_2_4.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def steps_TC_EEM_2_4(self) -> list[TestStep]:
5353
TestStep("4", "Wait 3 seconds"),
5454
TestStep("4a", "TH reads from the DUT the PeriodicEnergyImported attribute",
5555
"Verify the read is successful and note the value read."),
56-
TestStep("5", "Wait 5 seconds"),
56+
TestStep("5", "Wait 3 seconds"),
5757
TestStep("5a", "TH reads from the DUT the PeriodicEnergyImported attribute",
5858
"Verify the read is successful and that the value read has to be different from value measure in step 4a."),
5959
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
@@ -80,7 +80,7 @@ async def test_TC_EEM_2_4(self):
8080
periodic_energy_imported = await self.read_eem_attribute_expect_success("PeriodicEnergyImported")
8181

8282
self.step("5")
83-
time.sleep(5)
83+
time.sleep(3)
8484

8585
self.step("5a")
8686
periodic_energy_imported_2 = await self.read_eem_attribute_expect_success("PeriodicEnergyImported")

src/python_testing/TC_EEM_2_5.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def steps_TC_EEM_2_5(self) -> list[TestStep]:
5353
TestStep("4", "Wait 6 seconds"),
5454
TestStep("4a", "TH reads from the DUT the PeriodicEnergyExported attribute",
5555
"Verify the read is successful and note the value read."),
56-
TestStep("5", "Wait 11 seconds"),
56+
TestStep("5", "Wait 6 seconds"),
5757
TestStep("5a", "TH reads from the DUT the PeriodicEnergyExported attribute",
5858
"Verify the read is successful and that the value read has to be different from value measure in step 4a."),
5959
TestStep("6", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.EEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.EEM.TEST_EVENT_TRIGGER for Stop Fake Readings Test Event."),
@@ -80,7 +80,7 @@ async def test_TC_EEM_2_5(self):
8080
periodic_energy_exported = await self.read_eem_attribute_expect_success("PeriodicEnergyExported")
8181

8282
self.step("5")
83-
time.sleep(11)
83+
time.sleep(6)
8484

8585
self.step("5a")
8686
periodic_energy_exported_2 = await self.read_eem_attribute_expect_success("PeriodicEnergyExported")

src/python_testing/TC_EPM_2_2.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def steps_TC_EPM_2_2(self) -> list[TestStep]:
6161
"Verify the read is successful and that the value is between 3'848 and 4'848 mA. Note the value read."),
6262
TestStep("4c", "TH reads from the DUT the Voltage attribute",
6363
"Verify the read is successful and that the value is between 229'000 and 231'000 mV. Note the value read."),
64-
TestStep("5", "Wait 5 seconds"),
64+
TestStep("5", "Wait 3 seconds"),
6565
TestStep("5a", "TH reads from the DUT the ActivePower attribute",
6666
"Verify the read is successful, that the value is between '980'000 and 1'020'000 mW, and the value is different from the value read in step 4a."),
6767
TestStep("5b", "TH reads from the DUT the ActiveCurrent attribute",
@@ -105,8 +105,8 @@ async def test_TC_EPM_2_2(self):
105105
voltage = await self.check_epm_attribute_in_range("Voltage", 229000, 231000)
106106

107107
self.step("5")
108-
# After 5 seconds...
109-
time.sleep(5)
108+
# After 3 seconds...
109+
time.sleep(3)
110110

111111
self.step("5a")
112112
# Active power is Mandatory

0 commit comments

Comments
 (0)