You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2020/04/21 20:19:29 UTC

[kudu] 02/02: [test] Fix types-test on MacOS

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.12.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 2c5a1889192dd0ab20d32611064dbd240a17b464
Author: Grant Henke <gr...@apache.org>
AuthorDate: Tue Apr 21 09:49:15 2020 -0500

    [test] Fix types-test on MacOS
    
    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 <ba...@cloudera.com>
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    (cherry picked from commit d7a3cddd217d0de513483b3a9f911d83e1eeb5d2)
    Reviewed-on: http://gerrit.cloudera.org:8080/15773
    Reviewed-by: Volodymyr Verovkin <ve...@cloudera.com>
---
 src/kudu/common/types-test.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/kudu/common/types-test.cc b/src/kudu/common/types-test.cc
index a662e03..343d8ee 100644
--- a/src/kudu/common/types-test.cc
+++ b/src/kudu/common/types-test.cc
@@ -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);