Skip to content

Commit b7cf794

Browse files
committed
test: fixed test case
1 parent 62fcd37 commit b7cf794

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

e2e/src/test/java/com/arcadedb/e2e/JsFunctionsTest.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package com.arcadedb.e2e;
2020

21-
import com.arcadedb.function.FunctionDefinition;
2221
import com.arcadedb.query.sql.executor.ResultSet;
2322
import com.arcadedb.remote.RemoteDatabase;
2423
import org.junit.jupiter.api.AfterEach;
@@ -35,16 +34,27 @@ void setUp() {
3534
database = new RemoteDatabase(host, httpPort, "beer", "root", "playwithdata");
3635
// ENLARGE THE TIMEOUT TO PASS THESE TESTS ON CI (GITHUB ACTIONS)
3736
database.setTimeout(60_000);
37+
// Try to delete function first in case it exists from a previous failed test
38+
tryDeleteFunction("math", "sum");
3839
database.command("sql", "define function math.sum \"return a + b\" parameters [a,b] language js");
39-
4040
}
4141

4242
@AfterEach
4343
void tearDown() {
44-
database.command("sql", "delete function math.sum");
44+
tryDeleteFunction("math", "sum");
45+
tryDeleteFunction("Test", "objectComparison");
46+
tryDeleteFunction("Test", "lowercase");
4547
if (database != null) database.close();
4648
}
4749

50+
private void tryDeleteFunction(final String library, final String function) {
51+
try {
52+
database.command("sql", "delete function " + library + "." + function);
53+
} catch (final Exception ignored) {
54+
// Function might not exist or DELETE FUNCTION might not be supported in older versions
55+
}
56+
}
57+
4858
@Test
4959
void jsMathSum() {
5060
final ResultSet result = database.command("sql", "select `math.sum`(?,?) as result", 3, 5);

0 commit comments

Comments
 (0)