Skip to content

Commit 9a44e63

Browse files
committed
DST fixes unit test (#145)
* fix: remove wrong unit test on DST applicability Remove test from DST suites that was just checking that the chosen test dates have a certain DST applicability. This check fails on machines running on UTC machines. * fix: update cluster name in integration test - catalog is now called "elasticsearch" (cherry picked from commit 880d3d1)
1 parent 62e49da commit 9a44e63

File tree

3 files changed

+2
-24
lines changed

3 files changed

+2
-24
lines changed

test/integration/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
UID = "elastic"
1616
CONNECT_STRING = 'Driver={Elasticsearch Driver};UID=%s;PWD=%s;Secure=0;' % (UID, Elasticsearch.AUTH_PASSWORD)
17-
CATALOG = "distribution_run"
17+
CATALOG = "elasticsearch"
1818

1919
class Testing(unittest.TestCase):
2020

test/test_conversion_c2sql_timestamp.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,6 @@ class ConvertC2SQL_Timestamp_DST : public ConvertC2SQL_Timestamp
427427

428428
void timestamp_local_to_utc(TIMESTAMP_STRUCT *, BOOL);
429429

430-
BOOL dst_in_effect(TIMESTAMP_STRUCT *ts)
431-
{
432-
/* quick switch, only valid for the dates below */
433-
return 3 < ts->month && ts->month <= 10;
434-
}
435-
436430
public:
437431
ConvertC2SQL_Timestamp_DST()
438432
{
@@ -506,10 +500,6 @@ void ConvertC2SQL_Timestamp_DST::timestamp_local_to_utc(
506500
TIMESTAMP_STRUCT dst_local = {0};
507501
TM_TO_TIMESTAMP_STRUCT(local_tm_ptr, &dst_local, src_local->fraction);
508502

509-
/* check if test is valid for the local machine */
510-
EXPECT_TRUE((0 <= local_tm_ptr->tm_isdst) &&
511-
(0 < local_tm_ptr->tm_isdst) == dst_in_effect(src_local));
512-
513503
/* compare source local timestamp to that UTC'd by the driver and
514504
* localtime'd back above by the test */
515505
ASSERT_TRUE(memcmp(src_local, &dst_local, sizeof(dst_local)) == 0);

test/test_conversion_sql2c_timestamp.cc

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -562,20 +562,12 @@ class ConvertSQL2C_Timestamp_DST : public ConvertSQL2C_Timestamp
562562
void print_tm_timestamp(char *dest, size_t size,
563563
const char *templ, struct tm *src);
564564

565-
BOOL dst_in_effect(struct tm *tm)
566-
{
567-
int month = tm->tm_mon + 1;
568-
/* quick switch, only valid for the dates below */
569-
return 3 < month && month <= 10;
570-
}
571-
572565
public:
573566
ConvertSQL2C_Timestamp_DST()
574567
{
575568
/* Construct the tm structs of dates when DST is not and is in effect,
576569
* respectively. The DST applicability will depend on the testing
577-
* machine's settings and tests will fail early if not suitable for
578-
* local machine. */
570+
* machine's settings. */
579571

580572
/* 2000-01-01T12:00:00Z */
581573
no_dst_utc.tm_year = 2000 - 1900;
@@ -616,10 +608,6 @@ void ConvertSQL2C_Timestamp_DST::timestamp_utc_to_local(struct tm *utc,
616608
ASSERT_TRUE(local_tm_ptr != NULL);
617609

618610
TIMESTAMP_STRUCT local_ts = {0};
619-
/* If this fails, the test is not suitable: the DTS applicability is not
620-
* known or in-line with used dates. */
621-
EXPECT_TRUE((0 <= local_tm_ptr->tm_isdst) &&
622-
(0 < local_tm_ptr->tm_isdst) == dst_in_effect(utc));
623611
TM_TO_TIMESTAMP_STRUCT(local_tm_ptr, &local_ts, 0LU);
624612

625613
char fetched[1024], expected[1024];

0 commit comments

Comments
 (0)