Update circle ci for MySQL tests.

This commit is contained in:
go-jet 2019-08-08 10:51:59 +02:00
parent fbf5fbddbc
commit 4c5584aaae
8 changed files with 77 additions and 53 deletions

View file

@ -1,7 +1,6 @@
package mysql
import (
"fmt"
"github.com/go-jet/jet/internal/testutils"
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model"
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
@ -26,7 +25,7 @@ func TestAllTypes(t *testing.T) {
assert.NilError(t, err)
//testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
testutils.AssertJSON(t, dest, allTypesJson)
}
@ -96,7 +95,7 @@ LIMIT ?;
assert.NilError(t, err)
//testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
testutils.AssertJSON(t, dest, `
[
@ -421,7 +420,7 @@ LIMIT ?;
assert.NilError(t, err)
//testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
testutils.AssertJSONFile(t, dest, "./testdata/common/int_operators.json")
}
@ -523,7 +522,7 @@ func TestTimeExpressions(t *testing.T) {
CURRENT_TIME(3),
)
fmt.Println(query.Sql())
//fmt.Println(query.Sql())
testutils.AssertStatementSql(t, query, `
SELECT CAST(? AS TIME),
@ -711,7 +710,7 @@ func TestTimestampExpressions(t *testing.T) {
CURRENT_TIMESTAMP(2),
)
fmt.Println(query.DebugSql())
//fmt.Println(query.DebugSql())
testutils.AssertDebugStatementSql(t, query, `
SELECT all_types.timestamp = all_types.timestamp,
@ -756,7 +755,7 @@ func TestTimeLiterals(t *testing.T) {
TimestampT(timeT).AS("timestampT"),
).FROM(AllTypes).LIMIT(1)
fmt.Println(query.Sql())
//fmt.Println(query.Sql())
testutils.AssertStatementSql(t, query, `
SELECT CAST(? AS DATE) AS "date",
@ -783,7 +782,7 @@ LIMIT ?;
err = query.Query(db, &dest)
assert.NilError(t, err)
testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
testutils.AssertJSON(t, dest, `
{

View file

@ -63,8 +63,8 @@ ORDER BY actor.actor_id;
assert.Equal(t, len(dest), 200)
assert.DeepEqual(t, dest[0], actor1)
//testutils.JsonPrint(dest)
//testutils.JsonSave(dest, "mysql/testdata/all_actors.json")
//testutils.PrintJson(dest)
//testutils.SaveJsonFile(dest, "mysql/testdata/all_actors.json")
testutils.AssertJSONFile(t, dest, "mysql/testdata/all_actors.json")
}
@ -129,11 +129,11 @@ ORDER BY payment.customer_id, SUM(payment.amount) ASC;
assert.NilError(t, err)
//testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
assert.Equal(t, len(dest), 174)
//testutils.JsonSave(dest, "mysql/testdata/customer_payment_sum.json")
//testutils.SaveJsonFile(dest, "mysql/testdata/customer_payment_sum.json")
testutils.AssertJSONFile(t, dest, "mysql/testdata/customer_payment_sum.json")
}
@ -169,7 +169,7 @@ func TestSubQuery(t *testing.T) {
err := query.Query(db, &dest)
assert.NilError(t, err)
//testutils.JsonSave(dest, "mysql/testdata/r_rating_films.json")
//testutils.SaveJsonFile(dest, "mysql/testdata/r_rating_films.json")
testutils.AssertJSONFile(t, dest, "mysql/testdata/r_rating_films.json")
}
@ -317,7 +317,7 @@ LIMIT ?;
//assert.Equal(t, len(dest[0].Films), 10)
//assert.Equal(t, len(dest[0].Films[0].Actors), 10)
//testutils.JsonSave(dest, "./mysql/testdata/lang_film_actor_inventory_rental.json")
//testutils.SaveJsonFile(dest, "./mysql/testdata/lang_film_actor_inventory_rental.json")
testutils.AssertJSONFile(t, dest, "./mysql/testdata/lang_film_actor_inventory_rental.json")
}

View file

@ -1,7 +1,6 @@
package postgres
import (
"fmt"
"github.com/go-jet/jet/internal/testutils"
"github.com/go-jet/jet/postgres"
. "github.com/go-jet/jet/postgres"
@ -94,7 +93,7 @@ LIMIT $5;
assert.NilError(t, err)
//testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
testutils.AssertJSON(t, dest, `
[
@ -233,11 +232,7 @@ func TestStringOperators(t *testing.T) {
TO_HEX(AllTypes.IntegerPtr),
)
//_, args, _ := query.Sql()
//fmt.Println(query.Sql())
//fmt.Println(args[15])
fmt.Println(query.Sql())
err := query.Query(db, &struct{}{})
@ -408,7 +403,7 @@ LIMIT $35;
assert.NilError(t, err)
//testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
testutils.AssertJSONFile(t, dest, "./testdata/common/float_operators.json")
}
@ -485,7 +480,7 @@ func TestIntegerOperators(t *testing.T) {
CBRT(ABSi(AllTypes.BigInt)).AS("cbrt"),
).LIMIT(2)
fmt.Println(query.Sql())
//fmt.Println(query.Sql())
testutils.AssertStatementSql(t, query, `
SELECT all_types.big_int AS "all_types.big_int",
@ -547,8 +542,8 @@ LIMIT $22;
assert.NilError(t, err)
//testutils.JsonSave("./testdata/common/int_operators.json", dest)
//testutils.JsonPrint(dest)
//testutils.SaveJsonFile("./testdata/common/int_operators.json", dest)
//testutils.PrintJson(dest)
testutils.AssertJSONFile(t, dest, "./testdata/common/int_operators.json")
}

View file

@ -1051,11 +1051,11 @@ ORDER BY customer.customer_id, SUM(payment.amount) ASC;
assert.NilError(t, err)
//testutils.JsonPrint(dest)
//testutils.PrintJson(dest)
assert.Equal(t, len(dest), 104)
//testutils.JsonSave(dest, "postgres/testdata/customer_payment_sum.json")
//testutils.SaveJsonFile(dest, "postgres/testdata/customer_payment_sum.json")
testutils.AssertJSONFile(t, dest, "postgres/testdata/customer_payment_sum.json")
}