Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable inconsistent DST/Ansi/Gregorian timestamp conversion tests #13

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@ private DateArrayAccessorTestHelper(Getter g) {
Array expectedArray =
new ArrayFactoryImpl(DateTimeUtils.DEFAULT_ZONE).createArray(
intType, Arrays.asList(123, 18234));
assertTrue(ArrayImpl.equalContents(expectedArray, g.getArray(resultSet)));
// b/344910002: disable inconsistent timezone timestamp test
// assertTrue(ArrayImpl.equalContents(expectedArray, g.getArray(resultSet)));
}
}

Expand Down Expand Up @@ -1054,7 +1055,8 @@ private DateAccessorTestHelper(Getter g) {
}

@Override public void testGetString(ResultSet resultSet) throws SQLException {
assertEquals(DST_DATE_STRING, g.getString(resultSet));
// b/344910002: disable inconsistent timezone timestamp test
// assertEquals(DST_DATE_STRING, g.getString(resultSet));
}

@Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
Expand Down Expand Up @@ -1139,7 +1141,8 @@ private TimestampAccessorTestHelper(
}

@Override public void testGetString(ResultSet resultSet) throws SQLException {
assertEquals(DST_TIMESTAMP_STRING, g.getString(resultSet)); // Maybe delete
// b/344910002: disable inconsistent DST timestamp test
// assertEquals(DST_TIMESTAMP_STRING, g.getString(resultSet)); // Maybe delete
assertEquals(expectedString, g.getString(resultSet));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ public class TimestampWithLocalTimeZoneAccessorTest {

value = new Timestamp(SHIFT_INSTANT_1);
assertThat(instance.getString(), is(SHIFT_STRING_1));
value = new Timestamp(SHIFT_INSTANT_2);
assertThat(instance.getString(), is(SHIFT_STRING_2));

// b/344910002: disable inconsistent Gregorian shift test
// value = new Timestamp(SHIFT_INSTANT_2);
// assertThat(instance.getString(), is(SHIFT_STRING_2));

value = new Timestamp(SHIFT_INSTANT_3);
assertThat(instance.getString(), is(SHIFT_STRING_3));
value = new Timestamp(SHIFT_INSTANT_4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.calcite.avatica.util;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import java.sql.Date;
Expand Down Expand Up @@ -281,21 +282,23 @@ private void assertString(String valueString, String expected) throws SQLExcepti
/**
* Test {@code getTimestamp()} supports date range 0001-01-01 to 9999-12-31 required by ANSI SQL.
*/
// b/344910002: disable inconsistent ANSI timestamp format test
@Ignore
@Test public void testTimestampWithAnsiDateRange() throws SQLException {
for (int i = 1; i < 1943; ++i) {
assertTimestamp(i, TimeZone.getDefault().getRawOffset());
assertTimestamp(i, TimeZone.getDefault().getRawOffset());
}
for (int i = 1943; i < 1946; ++i) {
assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR);
assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR);
}
for (int i = 1946; i < 1949; ++i) {
assertTimestamp(i, TimeZone.getDefault().getRawOffset());
assertTimestamp(i, TimeZone.getDefault().getRawOffset());
}
for (int i = 1949; i < 1950; ++i) {
assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR);
assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR);
}
for (int i = 1950; i < 10000; ++i) {
assertTimestamp(i, TimeZone.getDefault().getRawOffset());
assertTimestamp(i, TimeZone.getDefault().getRawOffset());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,11 @@ public class TimestampWithLocalTimeZoneFromUtilDateAccessorTest {
@Test public void testStringWithGregorianShift() throws SQLException {
value = new Timestamp(SHIFT_INSTANT_1);
assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_1));
value = new Timestamp(SHIFT_INSTANT_2);
assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_2));

// b/344910002: disable inconsistent Gregorian shift test
// value = new Timestamp(SHIFT_INSTANT_2);
// assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_2));

value = new Timestamp(SHIFT_INSTANT_3);
assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_3));
value = new Timestamp(SHIFT_INSTANT_4);
Expand Down
Loading