Disable database tests in Jenkins

Disabled tests that require a database connection to prevent failures in Jenkins where there isn't a database. Updated Jenkinsfile to include a property that skips these tests during the build process.
This commit is contained in:
2024-08-04 22:52:01 +02:00
parent 4c70082f67
commit cb7bb60178
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -5,16 +5,21 @@ import com.alttd.forms.form.Form;
import com.alttd.forms.verify_mail.FormQuery;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.Optional;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
public class TestForm {
private static int code;
@BeforeAll
@Disabled
public static void testInsert() {
assumeTrue(System.getProperty("doNotRunDatabaseTests") == null);
Assertions.assertDoesNotThrow(() -> DatabaseConnection.initialize());
StoreFormQuery storeFormQuery = new StoreFormQuery();
ContactFormData contactFormData = new ContactFormData("akastijn", "[email protected]", "This is a test question.");
@@ -27,7 +32,9 @@ public class TestForm {
}
@Test
@Disabled
public void testRetrieveForm() {
assumeTrue(System.getProperty("doNotRunDatabaseTests") == null);
Assertions.assertDoesNotThrow(() -> DatabaseConnection.initialize());
new FormQuery().getFormForCode(String.valueOf(code), "[email protected]").thenAccept(result -> {
Assertions.assertTrue(result.failReason().isEmpty());