Skip to content

Commit 357910f

Browse files
committed
Added integration test for timestamp value range
1 parent 9a24f78 commit 357910f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

table/src/test/java/tech/ydb/table/integration/ValuesReadTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import org.junit.ClassRule;
88
import org.junit.Test;
99

10+
import tech.ydb.core.Issue;
11+
import tech.ydb.core.Status;
12+
import tech.ydb.core.StatusCode;
1013
import tech.ydb.table.SessionRetryContext;
1114
import tech.ydb.table.impl.SimpleTableClient;
1215
import tech.ydb.table.query.DataQueryResult;
@@ -138,5 +141,20 @@ public void timestampReadTest() {
138141
assertTimestamp(rs.getColumn("t3"), true, Instant.parse("2105-12-31T23:59:59.999999Z"));
139142
assertTimestamp(rs.getColumn("t4"), false, Instant.ofEpochSecond(0, 0));
140143
assertTimestamp(rs.getColumn("t5"), false, Instant.ofEpochSecond(4291747199l, 999999000l));
144+
145+
Status invalid = CTX.supplyResult(
146+
s -> s.executeDataQuery("SELECT "
147+
+ "Timestamp('1969-12-31T23:59:59.999999Z') as t6,"
148+
+ "Timestamp('2106-01-01T00:00:00.000000Z') as t7;",
149+
TxControl.serializableRw()
150+
)
151+
).join().getStatus();
152+
153+
Assert.assertEquals(StatusCode.GENERIC_ERROR, invalid.getCode());
154+
Issue[] issues = invalid.getIssues();
155+
Assert.assertEquals(2, issues.length);
156+
Assert.assertEquals("Invalid value \"1969-12-31T23:59:59.999999Z\" for type Timestamp", issues[0].getMessage());
157+
Assert.assertEquals("Invalid value \"2106-01-01T00:00:00.000000Z\" for type Timestamp", issues[1].getMessage());
158+
141159
}
142160
}

0 commit comments

Comments
 (0)