Skip to content

Commit

Permalink
Timesync: Add max size name check (#27619)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille authored and pull[bot] committed Oct 12, 2023
1 parent 0ebed68 commit ebb9d28
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/python_testing/TC_TIMESYNC_2_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,16 @@ async def test_TC_TIMESYNC_2_4(self):
tz = [tz_struct(offset=50401, validAt=0)]
await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ConstraintError)

self.print_step(14, "Send SetTimeZone command - too long name")
tz = [tz_struct(offset=50401, validAt=0, name="AVeryLongStringWithSixtyFiveChars/ThisIsSomeExtraPaddingForTheStr")]
self.print_step(14, "Send SetTimeZone command with max sized name")
tz = [tz_struct(offset=0, validAt=0, name="AVeryLongStringWithSixtyFourChars/ThisIsSomeExtraPaddingForTheSt")]
ret = await self.send_set_time_zone_cmd(tz=tz)
asserts.assert_true(ret.DSTOffsetRequired, "DSTOffsetRequired not set to true")

self.print_step(15, "Send SetTimeZone command - too long name")
tz = [tz_struct(offset=0, validAt=0, name="AVeryLongStringWithSixtyFiveChars/ThisIsSomeExtraPaddingForTheStr")]
await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ConstraintError)

self.print_step(15, "Send SetTimeZone command - too many entries")
self.print_step(16, "Send SetTimeZone command - too many entries")
if tz_max_size_dut == 2:
tz = [tz_struct(offset=3600, validAt=0, name="Europe/Dublin"),
tz_struct(offset=7200, validAt=utc_time_in_matter_epoch() +
Expand All @@ -128,15 +133,15 @@ async def test_TC_TIMESYNC_2_4(self):
]
await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ResourceExhausted)

self.print_step(16, "Send SetTimeZone command - too many entries")
self.print_step(17, "Send SetTimeZone command - too many entries")
if tz_max_size_dut == 1:
tz = [tz_struct(offset=3600, validAt=0, name="Europe/Dublin"),
tz_struct(offset=7200, validAt=utc_time_in_matter_epoch() +
timedelta(minutes=2).microseconds, name="Europe/Athens")
]
await self.send_set_time_zone_cmd_expect_error(tz=tz, error=Status.ResourceExhausted)

self.print_step(17, "Reset time zone")
self.print_step(18, "Reset time zone")
tz = [tz_struct(offset=0, validAt=0)]
await self.send_set_time_zone_cmd(tz=tz)

Expand Down

0 comments on commit ebb9d28

Please sign in to comment.