commit
117811df55
3 changed files with 33 additions and 2 deletions
7
.github/workflows/unit-test.yml
vendored
7
.github/workflows/unit-test.yml
vendored
|
|
@ -191,6 +191,7 @@ jobs:
|
|||
|
||||
echo ".:\n" && ls -l .
|
||||
echo "..:\n" && ls -l ..
|
||||
echo "../app:\n" && ls -l ../app
|
||||
ping -c 1 -t 1 local.iqka.com
|
||||
|
||||
- name: Test Prepare
|
||||
|
|
@ -199,6 +200,12 @@ jobs:
|
|||
make fmt-check
|
||||
make misspell-check
|
||||
|
||||
- name: Inspect
|
||||
run: |
|
||||
go run . run utils.env.Get MONGO_TEST_HOST
|
||||
go run . run utils.env.Get REDIS_TEST_HOST
|
||||
go run . inspect
|
||||
|
||||
- name: Run test
|
||||
run: |
|
||||
make test
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package connector
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/yaoapp/gou/connector"
|
||||
"github.com/yaoapp/kun/utils"
|
||||
"github.com/yaoapp/yao/config"
|
||||
"github.com/yaoapp/yao/test"
|
||||
)
|
||||
|
|
@ -13,7 +15,26 @@ func TestLoad(t *testing.T) {
|
|||
test.Prepare(t, config.Conf)
|
||||
defer test.Clean()
|
||||
|
||||
Load(config.Conf)
|
||||
err := Load(config.Conf)
|
||||
utils.Dump(config.Conf, "ERROR---", err, "-- END ERROR---")
|
||||
utils.Dump(
|
||||
"REDIS---",
|
||||
os.Getenv("REDIS_TEST_HOST"),
|
||||
os.Getenv("REDIS_TEST_PORT"),
|
||||
os.Getenv("REDIS_TEST_USER"),
|
||||
os.Getenv("REDIS_TEST_PASS"),
|
||||
"-- END REDIS---",
|
||||
)
|
||||
|
||||
utils.Dump(
|
||||
"SQLITE---",
|
||||
os.Getenv("SQLITE_DB"),
|
||||
"-- END SQLITE---",
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
check(t)
|
||||
}
|
||||
|
||||
|
|
@ -22,6 +43,9 @@ func check(t *testing.T) {
|
|||
for id := range connector.Connectors {
|
||||
ids[id] = true
|
||||
}
|
||||
|
||||
utils.Dump(ids)
|
||||
|
||||
assert.True(t, ids["mongo"])
|
||||
assert.True(t, ids["mysql"])
|
||||
assert.True(t, ids["redis"])
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ func TestAPI(t *testing.T) {
|
|||
|
||||
code, rows = httpGet[arr]("/dsl/ReadDir?name=/models&recursive=1", t)
|
||||
assert.Equal(t, 200, code)
|
||||
assert.Equal(t, 12, len(rows))
|
||||
assert.Equal(t, 13, len(rows))
|
||||
|
||||
code, length := httpPost[int]("/dsl/WriteFile?name=/models/foo.mod.yao", []byte(`{"name":"foo"}`), t)
|
||||
assert.Equal(t, 200, code)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue