fix(server/test): add dbPath to configs

This commit is contained in:
hexxa 2022-01-29 14:08:41 +08:00 committed by Hexxa
parent d0c0b80eff
commit 00bbb12843
5 changed files with 26 additions and 11 deletions

View file

@ -12,7 +12,7 @@ import (
func TestConcurrency(t *testing.T) { func TestConcurrency(t *testing.T) {
addr := "http://127.0.0.1:8686" addr := "http://127.0.0.1:8686"
rootPath := "testData" rootPath := "tmpTestData"
config := `{ config := `{
"users": { "users": {
"enableAuth": true, "enableAuth": true,
@ -30,7 +30,10 @@ func TestConcurrency(t *testing.T) {
"host": "127.0.0.1" "host": "127.0.0.1"
}, },
"fs": { "fs": {
"root": "testData" "root": "tmpTestData"
},
"db": {
"dbPath": "tmpTestData/quickshare"
} }
}` }`

View file

@ -17,7 +17,7 @@ import (
func TestFileHandlers(t *testing.T) { func TestFileHandlers(t *testing.T) {
addr := "http://127.0.0.1:8686" addr := "http://127.0.0.1:8686"
rootPath := "testData" rootPath := "tmpTestData"
config := `{ config := `{
"users": { "users": {
"enableAuth": true, "enableAuth": true,
@ -42,7 +42,10 @@ func TestFileHandlers(t *testing.T) {
"host": "127.0.0.1" "host": "127.0.0.1"
}, },
"fs": { "fs": {
"root": "testData" "root": "tmpTestData"
},
"db": {
"dbPath": "tmpTestData/quickshare"
} }
}` }`

View file

@ -17,7 +17,7 @@ import (
func TestSettingsHandlers(t *testing.T) { func TestSettingsHandlers(t *testing.T) {
addr := "http://127.0.0.1:8686" addr := "http://127.0.0.1:8686"
rootPath := "testData" rootPath := "tmpTestData"
config := `{ config := `{
"users": { "users": {
"enableAuth": true, "enableAuth": true,
@ -42,7 +42,10 @@ func TestSettingsHandlers(t *testing.T) {
"host": "127.0.0.1" "host": "127.0.0.1"
}, },
"fs": { "fs": {
"root": "testData" "root": "tmpTestData"
},
"db": {
"dbPath": "tmpTestData/quickshare"
} }
}` }`
adminName := "qs" adminName := "qs"

View file

@ -6,13 +6,13 @@ import (
"testing" "testing"
"github.com/ihexxa/quickshare/src/client" "github.com/ihexxa/quickshare/src/client"
q "github.com/ihexxa/quickshare/src/handlers"
"github.com/ihexxa/quickshare/src/db/userstore" "github.com/ihexxa/quickshare/src/db/userstore"
q "github.com/ihexxa/quickshare/src/handlers"
) )
func TestSpaceLimit(t *testing.T) { func TestSpaceLimit(t *testing.T) {
addr := "http://127.0.0.1:8686" addr := "http://127.0.0.1:8686"
rootPath := "testData" rootPath := "tmpTestData"
spaceLimit := 1000000 spaceLimit := 1000000
fileSize := 100000 fileSize := 100000
if spaceLimit%fileSize != 0 { if spaceLimit%fileSize != 0 {
@ -35,7 +35,10 @@ func TestSpaceLimit(t *testing.T) {
"host": "127.0.0.1" "host": "127.0.0.1"
}, },
"fs": { "fs": {
"root": "testData" "root": "tmpTestData"
},
"db": {
"dbPath": "tmpTestData/quickshare"
} }
}`, spaceLimit) }`, spaceLimit)

View file

@ -16,7 +16,7 @@ import (
func TestUsersHandlers(t *testing.T) { func TestUsersHandlers(t *testing.T) {
addr := "http://127.0.0.1:8686" addr := "http://127.0.0.1:8686"
rootPath := "testData" rootPath := "tmpTestData"
config := `{ config := `{
"users": { "users": {
"enableAuth": true, "enableAuth": true,
@ -41,7 +41,10 @@ func TestUsersHandlers(t *testing.T) {
"host": "127.0.0.1" "host": "127.0.0.1"
}, },
"fs": { "fs": {
"root": "testData" "root": "tmpTestData"
},
"db": {
"dbPath": "tmpTestData/quickshare"
} }
}` }`
adminName := "qs" adminName := "qs"