Skip to content

Commit 142fc7a

Browse files
committed
add skipping variant tests for older versions
1 parent 2f0fbe1 commit 142fc7a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.clickhouse.client.api.metadata.TableSchema;
1414
import com.clickhouse.client.api.query.GenericRecord;
1515
import com.clickhouse.data.ClickHouseDataType;
16+
import com.clickhouse.data.ClickHouseVersion;
1617
import lombok.AllArgsConstructor;
1718
import lombok.Data;
1819
import lombok.NoArgsConstructor;
@@ -143,6 +144,10 @@ public static String tblCreateSQL(String table) {
143144

144145
@Test(groups = {"integration"})
145146
public void testVariantWithSimpleDataTypes() throws Exception {
147+
if (isVersionMatch("(,24.8]")) {
148+
return;
149+
}
150+
146151
final String table = "test_variant_primitives";
147152
final DataTypesTestingPOJO sample = new DataTypesTestingPOJO();
148153

@@ -384,6 +389,10 @@ public void testVariantWithTuple() throws Exception {
384389
}
385390

386391
private void testVariantWith(String withWhat, String[] fields, Object[] values, String[] expectedStrValues) throws Exception {
392+
if (isVersionMatch("(,24.8]")) {
393+
return;
394+
}
395+
387396
String table = "test_variant_with_" + withWhat;
388397
String[] actualFields = new String[fields.length + 1];
389398
actualFields[0] = "rowId Int32";
@@ -417,4 +426,8 @@ public static String tableDefinition(String table, String... columns) {
417426
return sb.toString();
418427
}
419428

429+
public boolean isVersionMatch(String versionExpression) {
430+
List<GenericRecord> serverVersion = client.queryAll("SELECT version()");
431+
return ClickHouseVersion.of(serverVersion.get(0).getString(1)).check(versionExpression);
432+
}
420433
}

0 commit comments

Comments
 (0)