Skip to content

Commit

Permalink
[test] Fix types-test on MacOS
Browse files Browse the repository at this point in the history
In MacOS the `%F` date format pads the date with leading zeros. While
on other linux distributions it does not. It appears to be an issue for other
software as well:
https://bugs.python.org/issue32195

As a quick workaround I added special handling to the test for leading
zeros.

Change-Id: Ic11d2e1828e141f678ea8f417c57b188e322c660
Reviewed-on: http://gerrit.cloudera.org:8080/15768
Tested-by: Kudu Jenkins
Reviewed-by: Bankim Bhavsar <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>
  • Loading branch information
granthenke committed Apr 21, 2020
1 parent 98b1c5d commit d7a3cdd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/kudu/common/types-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ class TestTypes : public KuduTest {
};

TEST_F(TestTypes, TestDatePrinting) {
#if defined(__APPLE__)
// On MacOS the `%F` date format pads the year with zeros.
TestDateToString("0001-01-01", *DataTypeTraits<DATE>::min_value());
#else
TestDateToString("1-01-01", *DataTypeTraits<DATE>::min_value());
#endif
TestDateToString("9999-12-31", *DataTypeTraits<DATE>::max_value());
TestDateToString("1970-01-01", 0);
TestDateToString("1942-08-16", -10000);
Expand Down

0 comments on commit d7a3cdd

Please sign in to comment.