mirror of
https://gitee.com/johng/gf.git
synced 2024-11-29 18:57:44 +08:00
parent
5884a0e05f
commit
5a8b33fa09
2
.github/workflows/build_and_test.sh
vendored
2
.github/workflows/build_and_test.sh
vendored
@ -40,8 +40,10 @@ for file in `find . -name go.mod`; do
|
|||||||
go mod tidy
|
go mod tidy
|
||||||
go build ./...
|
go build ./...
|
||||||
go test ./... -race -coverprofile=coverage.out -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
|
go test ./... -race -coverprofile=coverage.out -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
|
||||||
|
|
||||||
if grep -q "/gogf/gf/.*/v2" go.mod; then
|
if grep -q "/gogf/gf/.*/v2" go.mod; then
|
||||||
sed -i "s/gogf\/gf\(\/.*\)\/v2/gogf\/gf\/v2\1/g" coverage.out
|
sed -i "s/gogf\/gf\(\/.*\)\/v2/gogf\/gf\/v2\1/g" coverage.out
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
done
|
done
|
4
.github/workflows/gf.yml
vendored
4
.github/workflows/gf.yml
vendored
@ -180,9 +180,7 @@ jobs:
|
|||||||
run: bash .github/workflows/before_script.sh
|
run: bash .github/workflows/before_script.sh
|
||||||
|
|
||||||
- name: Build & Test
|
- name: Build & Test
|
||||||
run: |
|
run: bash .github/workflows/build_and_test.sh
|
||||||
GOARCH=${{ matrix.goarch }}
|
|
||||||
bash .github/workflows/build_and_test.sh
|
|
||||||
|
|
||||||
- name: Stop Redis Cluster Containers
|
- name: Stop Redis Cluster Containers
|
||||||
run: docker-compose -f ".github/workflows/redis/docker-compose.yml" down
|
run: docker-compose -f ".github/workflows/redis/docker-compose.yml" down
|
||||||
|
@ -42,7 +42,7 @@ func Test_Model_Raw(t *testing.T) {
|
|||||||
|
|
||||||
gtest.C(t, func(t *gtest.T) {
|
gtest.C(t, func(t *gtest.T) {
|
||||||
count, err := db.Model(table).Raw(fmt.Sprintf("select id from %s ", table)).Count()
|
count, err := db.Model(table).Raw(fmt.Sprintf("select id from %s ", table)).Count()
|
||||||
t.Assert(count, int64(10))
|
t.Assert(count, 10)
|
||||||
t.AssertNil(err)
|
t.AssertNil(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -249,12 +249,12 @@ func Test_Model_Count(t *testing.T) {
|
|||||||
gtest.C(t, func(t *gtest.T) {
|
gtest.C(t, func(t *gtest.T) {
|
||||||
count, err := db.Model(table).Count()
|
count, err := db.Model(table).Count()
|
||||||
t.AssertNil(err)
|
t.AssertNil(err)
|
||||||
t.Assert(count, int64(TableSize))
|
t.Assert(count, TableSize)
|
||||||
})
|
})
|
||||||
gtest.C(t, func(t *gtest.T) {
|
gtest.C(t, func(t *gtest.T) {
|
||||||
count, err := db.Model(table).FieldsEx("id").Where("id>8").Count()
|
count, err := db.Model(table).FieldsEx("id").Where("id>8").Count()
|
||||||
t.AssertNil(err)
|
t.AssertNil(err)
|
||||||
t.Assert(count, int64(2))
|
t.Assert(count, 2)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ func TestDriverClickhouse_Insert(t *testing.T) {
|
|||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
total, err = connect.Model("visits").Count()
|
total, err = connect.Model("visits").Count()
|
||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
gtest.AssertEQ(total, int64(2))
|
gtest.AssertEQ(total, 2)
|
||||||
var list []*insertItem
|
var list []*insertItem
|
||||||
for i := 0; i < 50; i++ {
|
for i := 0; i < 50; i++ {
|
||||||
list = append(list, &insertItem{
|
list = append(list, &insertItem{
|
||||||
@ -312,7 +312,7 @@ func TestDriverClickhouse_Insert(t *testing.T) {
|
|||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
total, err = connect.Model("visits").Count()
|
total, err = connect.Model("visits").Count()
|
||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
gtest.AssertEQ(total, int64(102))
|
gtest.AssertEQ(total, 102)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDriverClickhouse_Insert_Use_Exec(t *testing.T) {
|
func TestDriverClickhouse_Insert_Use_Exec(t *testing.T) {
|
||||||
@ -467,7 +467,7 @@ func TestDriverClickhouse_NilTime(t *testing.T) {
|
|||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
count, err := connect.Model("data_type").Where("Col4", "Inc.").Count()
|
count, err := connect.Model("data_type").Where("Col4", "Inc.").Count()
|
||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
gtest.AssertEQ(count, int64(10000))
|
gtest.AssertEQ(count, 10000)
|
||||||
|
|
||||||
data, err := connect.Model("data_type").Where("Col4", "Inc.").One()
|
data, err := connect.Model("data_type").Where("Col4", "Inc.").One()
|
||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
@ -508,7 +508,7 @@ func TestDriverClickhouse_BatchInsert(t *testing.T) {
|
|||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
count, err := connect.Model("data_type").Where("Col2", "ClickHouse").Where("Col3", "Inc").Count()
|
count, err := connect.Model("data_type").Where("Col2", "ClickHouse").Where("Col3", "Inc").Count()
|
||||||
gtest.AssertNil(err)
|
gtest.AssertNil(err)
|
||||||
gtest.AssertEQ(count, int64(10000))
|
gtest.AssertEQ(count, 10000)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDriverClickhouse_Open(t *testing.T) {
|
func TestDriverClickhouse_Open(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user