-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix datbase tests and enable running using GitHub workflows
- fix behavior when no entries have to be inserted during a synch - fix database tests - have dbms test test only one database - DBMS to test is passed via environment variable "DBMS", defaulting to PostgreSQL - add shared information on Canonical BibTeX entry - some code improvement - have checkstyle running on github workflows (not on Travis)
- Loading branch information
Showing
19 changed files
with
436 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: checkstyle | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v1 | ||
with: | ||
depth: 1 | ||
submodules: false | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 13 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.OS }}-gradle-${{ env.cache-name }}- | ||
${{ runner.OS }}-gradle- | ||
${{ runner.OS }}- | ||
- name: Run checkstyle test | ||
run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Test on MySQL | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Shutdown Ubuntu MySQL (SUDO) | ||
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it | ||
- uses: mirromutth/mysql-action@v1.1 | ||
with: | ||
host port: 3800 | ||
container port: 3307 | ||
character set server: 'utf8' | ||
collation server: 'utf8_general_ci' | ||
mysql version: '8.0' | ||
mysql database: 'jabref' | ||
mysql root password: 'root' | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 13 | ||
- name: Checkout source | ||
uses: actions/checkout@v1 | ||
with: | ||
depth: 1 | ||
submodules: false | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.OS }}-gradle-${{ env.cache-name }}- | ||
${{ runner.OS }}-gradle- | ||
${{ runner.OS }}- | ||
- name: Run database test | ||
run: ./gradlew databaseTest | ||
env: | ||
DBMS: "mysql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Test on PostgreSQL | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:10.8 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v1 | ||
with: | ||
depth: 1 | ||
submodules: false | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 13 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: | | ||
${{ runner.OS }}-gradle-${{ env.cache-name }}- | ||
${{ runner.OS }}-gradle- | ||
${{ runner.OS }}- | ||
- name: Run database test | ||
run: ./gradlew databaseTest | ||
env: | ||
DBMS: "postgresql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# How to test | ||
|
||
## Database tests | ||
|
||
To quickly host a local PostgreSQL database, execute following statement: | ||
|
||
```shell command | ||
docker run -d -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -p 5432:5432 --name db postgres:10 postgres -c log_statement=all | ||
``` | ||
|
||
Then, all DBMS Tests (annotated with `@org.jabref.testutils.category.DatabaseTest`) run properly. | ||
|
||
A MySQL can be started using following command: | ||
|
||
``´shell command | ||
docker run -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=jabref -p 3800:3307 mysql:8.0 --port=3307 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/java/org/jabref/logic/shared/DBMSConnectionPropertiesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.jabref.logic.shared; | ||
|
||
import org.jabref.model.database.shared.DBMSType; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class DBMSConnectionPropertiesTest { | ||
|
||
@Test | ||
void urlForMySqlIncludesSslConfig() { | ||
DBMSConnectionProperties connectionProperties = new DBMSConnectionProperties(DBMSType.MYSQL, "localhost", 3108, "jabref", "user", "password", false, ""); | ||
assertEquals("jdbc:mariadb://localhost:3108/jabref?allowPublicKeyRetrieval=true&useSSL=false", connectionProperties.getUrl()); | ||
} | ||
} |
Oops, something went wrong.