Skip to content

Commit 5aabf74

Browse files
committed
Don't run JSON Serialization tests against Server versions which don't support them
1 parent e1936b0 commit 5aabf74

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/test/java/com/fusiondb/studio/api/API.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public class API {
6161
*/
6262
public static String ENV_VAR_FS_API_PORT = "FS_API_PORT";
6363

64+
private static String ENV_VAR_DOCKER_TEST_IMAGE = "DOCKER_TEST_IMAGE";
65+
6466
/**
6567
* Get the Base URI for the Fusion Studio API.
6668
*
@@ -141,6 +143,7 @@ static <K, V> Map<K, V> mapOf(final Tuple2<K, V>... entries) {
141143
return map;
142144
}
143145

146+
144147
static <K, V> Map<K, V>[] arrayOf(final Map<K, V>... entries) {
145148
if (entries == null) {
146149
return new Map[0];
@@ -152,4 +155,15 @@ static <K, V> Map<K, V>[] arrayOf(final Map<K, V>... entries) {
152155
}
153156
return arrayOfMaps;
154157
}
158+
159+
static boolean testServerHasBadJsonSerialization() {
160+
final String dockerTestImage = envVarOrDefault(ENV_VAR_DOCKER_TEST_IMAGE, null, envVarValue -> envVarValue);
161+
if (dockerTestImage == null || dockerTestImage.isEmpty()) {
162+
return false;
163+
}
164+
165+
return dockerTestImage.endsWith("fusiondb-server:1.0.0-ALPHA2")
166+
|| dockerTestImage.endsWith("existdb:5.0.0")
167+
|| dockerTestImage.endsWith("existdb:5.2.0");
168+
}
155169
}

src/test/java/com/fusiondb/studio/api/QueryIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package com.fusiondb.studio.api;
1919

20+
import org.junit.jupiter.api.Assumptions;
2021
import org.junit.jupiter.api.BeforeAll;
2122
import org.junit.jupiter.api.Test;
2223

@@ -256,6 +257,8 @@ public void serializeQueryAsAdaptive() {
256257

257258
@Test
258259
public void serializeQueryAsJsonNoIndent() {
260+
Assumptions.assumeFalse(testServerHasBadJsonSerialization());
261+
259262
final Map<String, Object> requestBody = mapOf(
260263
Tuple("query", "map {'a': 'b', 'x': ['y', 'z'], 't': true(), 'f': false() }"),
261264
Tuple("defaultSerialization", mapOf(
@@ -278,6 +281,8 @@ public void serializeQueryAsJsonNoIndent() {
278281

279282
@Test
280283
public void serializeQueryAsJsonIndent() {
284+
Assumptions.assumeFalse(testServerHasBadJsonSerialization());
285+
281286
final Map<String, Object> requestBody = mapOf(
282287
Tuple("query", "map {'a': 'b', 'x': ['y', 'z'], 't': true(), 'f': false() }"),
283288
Tuple("defaultSerialization", mapOf(

0 commit comments

Comments
 (0)