workflow: execute test cases on MySQL too
This commit is contained in:
parent
0056984d4b
commit
ddf99ab706
3 changed files with 56 additions and 22 deletions
54
.github/workflows/development.yml
vendored
54
.github/workflows/development.yml
vendored
|
@ -17,7 +17,7 @@ jobs:
|
|||
version: v1.27
|
||||
|
||||
tests-upload-unix:
|
||||
name: Run tests and upload build artifacts on Linux and macOS
|
||||
name: Run tests and upload build artifacts
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -118,16 +118,9 @@ jobs:
|
|||
name: sftpgo-windows
|
||||
path: output
|
||||
|
||||
tests-postgresql:
|
||||
name: Run test cases using PostgreSQL as data provider
|
||||
tests-postgresql-mysql:
|
||||
name: Run test cases using PostgreSQL/MySQL data providers
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SFTPGO_DATA_PROVIDER__DRIVER: postgresql
|
||||
SFTPGO_DATA_PROVIDER__NAME: sftpgo
|
||||
SFTPGO_DATA_PROVIDER__HOST: localhost
|
||||
SFTPGO_DATA_PROVIDER__PORT: 5432
|
||||
SFTPGO_DATA_PROVIDER__USERNAME: postgres
|
||||
SFTPGO_DATA_PROVIDER__PASSWORD: postgres
|
||||
|
||||
services:
|
||||
postgres:
|
||||
|
@ -143,6 +136,21 @@ jobs:
|
|||
ports:
|
||||
- 5432:5432
|
||||
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: mysql
|
||||
MYSQL_DATABASE: sftpgo
|
||||
MYSQL_USER: sftpgo
|
||||
MYSQL_PASSWORD: sftpgo
|
||||
options: >-
|
||||
--health-cmd "mysqladmin status -h 127.0.0.1 -P 3306 -u root -p$MYSQL_ROOT_PASSWORD"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 6
|
||||
ports:
|
||||
- 3307:3306
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
@ -154,8 +162,26 @@ jobs:
|
|||
- name: Build
|
||||
run: go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
|
||||
|
||||
- name: Initialize data provider
|
||||
run: ./sftpgo initprovider
|
||||
|
||||
- name: Run tests using PostgreSQL provider
|
||||
run: go test -v ./... -covermode=atomic
|
||||
run: |
|
||||
./sftpgo initprovider
|
||||
go test -v ./... -covermode=atomic
|
||||
env:
|
||||
SFTPGO_DATA_PROVIDER__DRIVER: postgresql
|
||||
SFTPGO_DATA_PROVIDER__NAME: sftpgo
|
||||
SFTPGO_DATA_PROVIDER__HOST: localhost
|
||||
SFTPGO_DATA_PROVIDER__PORT: 5432
|
||||
SFTPGO_DATA_PROVIDER__USERNAME: postgres
|
||||
SFTPGO_DATA_PROVIDER__PASSWORD: postgres
|
||||
|
||||
- name: Run tests using MySQL provider
|
||||
run: |
|
||||
./sftpgo initprovider
|
||||
go test -v ./... -covermode=atomic
|
||||
env:
|
||||
SFTPGO_DATA_PROVIDER__DRIVER: mysql
|
||||
SFTPGO_DATA_PROVIDER__NAME: sftpgo
|
||||
SFTPGO_DATA_PROVIDER__HOST: localhost
|
||||
SFTPGO_DATA_PROVIDER__PORT: 3307
|
||||
SFTPGO_DATA_PROVIDER__USERNAME: sftpgo
|
||||
SFTPGO_DATA_PROVIDER__PASSWORD: sftpgo
|
||||
|
|
|
@ -62,7 +62,7 @@ Some Linux distro packages are available:
|
|||
- [sftpgo-bin](https://aur.archlinux.org/packages/sftpgo-bin/). This package follows stable releases downloading the prebuilt linux binary from GitHub. It does not require `git`, `gcc` and `go` to build.
|
||||
- [sftpgo-git](https://aur.archlinux.org/packages/sftpgo-git/). This package builds and installs the latest git master. It requires `git`, `gcc` and `go` to build.
|
||||
|
||||
You can easily test new features selecting a commit from the [Actions](./actions) page and downloading the matching build artifacts for Linux, macOS or Windows. GitHub stores artifacts for 90 days.
|
||||
You can easily test new features selecting a commit from the [Actions](https://github.com/drakkan/sftpgo/actions) page and downloading the matching build artifacts for Linux, macOS or Windows. GitHub stores artifacts for 90 days.
|
||||
|
||||
Alternately, you can [build from source](./docs/build-from-source.md).
|
||||
|
||||
|
|
|
@ -1091,6 +1091,16 @@ func TestStartQuotaScan(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
_, err = httpd.StartFolderQuotaScan(folder, http.StatusCreated)
|
||||
assert.NoError(t, err)
|
||||
for {
|
||||
quotaScan, _, err := httpd.GetFoldersQuotaScans(http.StatusOK)
|
||||
if !assert.NoError(t, err, "Error getting active scans") {
|
||||
break
|
||||
}
|
||||
if len(quotaScan) == 0 {
|
||||
break
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
_, err = httpd.RemoveFolder(folder, http.StatusOK)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
@ -1875,14 +1885,13 @@ func TestStartQuotaScanMock(t *testing.T) {
|
|||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusCreated, rr.Code)
|
||||
|
||||
var scans []sftpd.ActiveQuotaScan
|
||||
for {
|
||||
var scans []sftpd.ActiveQuotaScan
|
||||
req, _ = http.NewRequest(http.MethodGet, quotaScanPath, nil)
|
||||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr.Code)
|
||||
err = render.DecodeJSON(rr.Body, &scans)
|
||||
if !assert.NoError(t, err) {
|
||||
assert.Fail(t, err.Error(), "Error get active scans")
|
||||
if !assert.NoError(t, err, "Error getting active scans") {
|
||||
break
|
||||
}
|
||||
if len(scans) == 0 {
|
||||
|
@ -1899,14 +1908,14 @@ func TestStartQuotaScanMock(t *testing.T) {
|
|||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusCreated, rr.Code)
|
||||
|
||||
scans = nil
|
||||
for {
|
||||
var scans []sftpd.ActiveQuotaScan
|
||||
req, _ = http.NewRequest(http.MethodGet, quotaScanPath, nil)
|
||||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr.Code)
|
||||
err = render.DecodeJSON(rr.Body, &scans)
|
||||
if !assert.NoError(t, err) {
|
||||
assert.Fail(t, err.Error(), "Error get active scans")
|
||||
assert.Fail(t, err.Error(), "Error getting active scans")
|
||||
break
|
||||
}
|
||||
if len(scans) == 0 {
|
||||
|
@ -2017,8 +2026,7 @@ func TestStartFolderQuotaScanMock(t *testing.T) {
|
|||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr.Code)
|
||||
err = render.DecodeJSON(rr.Body, &scans)
|
||||
if !assert.NoError(t, err) {
|
||||
assert.Fail(t, err.Error(), "Error get active folders scans")
|
||||
if !assert.NoError(t, err, "Error getting active folders scans") {
|
||||
break
|
||||
}
|
||||
if len(scans) == 0 {
|
||||
|
|
Loading…
Reference in a new issue