Skip to content

Commit

Permalink
Fix flaky copy test by generating fixed test data
Browse files Browse the repository at this point in the history
The copy test is flaky because some test data is generated
dynamically based on the current date. This patch changes the data
generation to a time series with fixed dates.
  • Loading branch information
jnidzwetzki committed May 31, 2022
1 parent 1fbe2eb commit 1d0670e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
7 changes: 3 additions & 4 deletions test/expected/copy-12.out
Expand Up @@ -324,13 +324,12 @@ INSERT INTO hyper_copy_large
SELECT time,
random() AS value
FROM
generate_series(now() - INTERVAL '1 months', now() - INTERVAL '1 day',
INTERVAL '1 hour') AS g1(time)
generate_series('2022-01-01', '2022-01-31', INTERVAL '1 hour') AS g1(time)
ORDER BY time;
SELECT COUNT(*) FROM hyper_copy_large;
count
-------
697
721
(1 row)

-- Migrate data to chunks by using copy
Expand All @@ -345,7 +344,7 @@ NOTICE: migrating data to chunks
SELECT COUNT(*) FROM hyper_copy_large;
count
-------
697
721
(1 row)

----------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions test/expected/copy-13.out
Expand Up @@ -324,13 +324,12 @@ INSERT INTO hyper_copy_large
SELECT time,
random() AS value
FROM
generate_series(now() - INTERVAL '1 months', now() - INTERVAL '1 day',
INTERVAL '1 hour') AS g1(time)
generate_series('2022-01-01', '2022-01-31', INTERVAL '1 hour') AS g1(time)
ORDER BY time;
SELECT COUNT(*) FROM hyper_copy_large;
count
-------
697
721
(1 row)

-- Migrate data to chunks by using copy
Expand All @@ -345,7 +344,7 @@ NOTICE: migrating data to chunks
SELECT COUNT(*) FROM hyper_copy_large;
count
-------
697
721
(1 row)

----------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions test/expected/copy-14.out
Expand Up @@ -324,13 +324,12 @@ INSERT INTO hyper_copy_large
SELECT time,
random() AS value
FROM
generate_series(now() - INTERVAL '1 months', now() - INTERVAL '1 day',
INTERVAL '1 hour') AS g1(time)
generate_series('2022-01-01', '2022-01-31', INTERVAL '1 hour') AS g1(time)
ORDER BY time;
SELECT COUNT(*) FROM hyper_copy_large;
count
-------
697
721
(1 row)

-- Migrate data to chunks by using copy
Expand All @@ -345,7 +344,7 @@ NOTICE: migrating data to chunks
SELECT COUNT(*) FROM hyper_copy_large;
count
-------
697
721
(1 row)

----------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions test/sql/copy.sql.in
Expand Up @@ -276,8 +276,7 @@ INSERT INTO hyper_copy_large
SELECT time,
random() AS value
FROM
generate_series(now() - INTERVAL '1 months', now() - INTERVAL '1 day',
INTERVAL '1 hour') AS g1(time)
generate_series('2022-01-01', '2022-01-31', INTERVAL '1 hour') AS g1(time)
ORDER BY time;

SELECT COUNT(*) FROM hyper_copy_large;
Expand Down

0 comments on commit 1d0670e

Please sign in to comment.