jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject failing timeshift test
Date Sat, 07 Mar 2020 13:56:32 GMT
Hi all,

the test TestTimeShiftFunction#testNowWithComplexPeriod is failing
probably due to a transition period shortly before day light saving time
switch.

The code is

@Test
    public void testNowWithComplexPeriod() throws Exception {
        Collection<CompoundVariable> params =
makeParams("yyyy-MM-dd'T'HH:mm:ss", "", "P10DT-1H-5M5S", "");
        function.setParameters(params);
        value = function.execute(result, null);
        LocalDateTime futureDate =
LocalDateTime.now().plusDays(10).plusHours(-1).plusMinutes(-5).plusSeconds(5);
        LocalDateTime futureDateFromFunction = LocalDateTime.parse(value);
        assertThat(futureDateFromFunction, within(1, ChronoUnit.SECONDS,
futureDate));
    }

any idea how to make it aware of this transition period without giving
up a non timezone aware current time?

I thought of checking the day light settings for the locale for the
current and the future date, and calculating a difference if necessary.

Felix


Mime
View raw message