Fix timezone specific failing test
Converts date time to a local now
This commit is contained in:
parent
bb4a54eb5d
commit
e8f462fab0
1 changed files with 8 additions and 1 deletions
|
@ -710,7 +710,9 @@ schedule_test() ->
|
||||||
schedule_test_bycount(4).
|
schedule_test_bycount(4).
|
||||||
|
|
||||||
schedule_test_bycount(N) ->
|
schedule_test_bycount(N) ->
|
||||||
CurrentTS = {1490,884020,0}, % Actually 30th March 2017 15:27
|
LocalTimeAsDateTime = {{2017,3,30},{15,27,0}},
|
||||||
|
CurrentTS= local_time_to_now(LocalTimeAsDateTime),
|
||||||
|
%% CurrentTS = {1490,884020,0}, % Actually 30th March 2017 15:27
|
||||||
SecondsToCompaction0 = schedule_compaction([16], N, CurrentTS),
|
SecondsToCompaction0 = schedule_compaction([16], N, CurrentTS),
|
||||||
io:format("Seconds to compaction ~w~n", [SecondsToCompaction0]),
|
io:format("Seconds to compaction ~w~n", [SecondsToCompaction0]),
|
||||||
?assertMatch(true, SecondsToCompaction0 > 1800),
|
?assertMatch(true, SecondsToCompaction0 > 1800),
|
||||||
|
@ -721,6 +723,11 @@ schedule_test_bycount(N) ->
|
||||||
?assertMatch(true, SecondsToCompaction1 >= 81180),
|
?assertMatch(true, SecondsToCompaction1 >= 81180),
|
||||||
?assertMatch(true, SecondsToCompaction1 =< 84780).
|
?assertMatch(true, SecondsToCompaction1 =< 84780).
|
||||||
|
|
||||||
|
local_time_to_now(DateTime) ->
|
||||||
|
[UTC] = calendar:local_time_to_universal_time_dst(DateTime),
|
||||||
|
Epoch = calendar:datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}}),
|
||||||
|
Seconds = calendar:datetime_to_gregorian_seconds(UTC) - Epoch,
|
||||||
|
{Seconds div 1000000, Seconds rem 1000000, 0}.
|
||||||
|
|
||||||
simple_score_test() ->
|
simple_score_test() ->
|
||||||
Run1 = [#candidate{compaction_perc = 75.0},
|
Run1 = [#candidate{compaction_perc = 75.0},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue