2019-01-09 10:56:39 +03:00
|
|
|
package worldconfig
|
2019-01-04 15:02:17 +03:00
|
|
|
|
|
|
|
import (
|
2019-01-05 19:21:24 +03:00
|
|
|
"fmt"
|
2019-01-13 18:37:03 +03:00
|
|
|
"testing"
|
2019-01-04 15:02:17 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestParseSqlite(t *testing.T) {
|
2019-01-09 10:56:39 +03:00
|
|
|
cfg := Parse("./testdata/world.mt.sqlite")
|
|
|
|
if cfg.Backend != BACKEND_SQLITE3 {
|
2019-01-04 15:02:17 +03:00
|
|
|
t.Fatal("not sqlite3")
|
|
|
|
}
|
2019-01-09 10:56:39 +03:00
|
|
|
if cfg.PlayerBackend != BACKEND_FILES {
|
2019-01-04 15:02:17 +03:00
|
|
|
t.Fatal("not files")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestParsePostgres(t *testing.T) {
|
2019-01-09 10:56:39 +03:00
|
|
|
cfg := Parse("./testdata/world.mt.postgres")
|
2019-01-05 19:21:24 +03:00
|
|
|
fmt.Println(cfg)
|
2019-01-09 10:56:39 +03:00
|
|
|
if cfg.Backend != BACKEND_POSTGRES {
|
2019-01-04 15:02:17 +03:00
|
|
|
t.Fatal("not postgres")
|
|
|
|
}
|
2019-01-04 17:02:25 +03:00
|
|
|
|
2019-01-09 10:56:39 +03:00
|
|
|
if cfg.PlayerBackend != BACKEND_POSTGRES {
|
2019-01-04 15:02:17 +03:00
|
|
|
t.Fatal("not postgres")
|
|
|
|
}
|
2019-01-04 17:02:25 +03:00
|
|
|
|
2019-01-04 18:10:21 +03:00
|
|
|
if cfg.PsqlConnection.Host != "postgres" {
|
2019-01-04 17:02:25 +03:00
|
|
|
t.Fatal("param err")
|
|
|
|
}
|
2019-01-04 18:30:18 +03:00
|
|
|
|
|
|
|
if cfg.PsqlConnection.Port != 5432 {
|
|
|
|
t.Fatal("param err: ", cfg.PsqlConnection.Port)
|
|
|
|
}
|
2019-01-04 15:02:17 +03:00
|
|
|
}
|