Add test for mysql8.0 (#1538)

Fix pk order on test

Add test for mysql8.0

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1538
This commit is contained in:
Lunny Xiao 2020-02-21 10:07:08 +00:00
parent bc8bb23ad0
commit 35b2813796
2 changed files with 36 additions and 2 deletions

View File

@ -45,6 +45,24 @@ steps:
- push - push
- pull_request - pull_request
- name: test-mysql8
image: golang:1.12
environment:
GO111MODULE: "on"
GOPROXY: "https://goproxy.cn"
TEST_MYSQL_HOST: mysql8
TEST_MYSQL_CHARSET: utf8mb4
TEST_MYSQL_DBNAME: xorm_test
TEST_MYSQL_USERNAME: root
TEST_MYSQL_PASSWORD:
commands:
- make test-mysql
- TEST_CACHE_ENABLE=true make test-mysql
when:
event:
- push
- pull_request
- name: test-mysql-utf8mb4 - name: test-mysql-utf8mb4
image: golang:1.12 image: golang:1.12
depends_on: depends_on:
@ -170,6 +188,7 @@ steps:
- test-vet - test-vet
- test-sqlite - test-sqlite
- test-mysql - test-mysql
- test-mysql8
- test-mymysql - test-mymysql
- test-postgres - test-postgres
- test-postgres-schema - test-postgres-schema
@ -196,6 +215,18 @@ services:
- tag - tag
- pull_request - pull_request
- name: mysql8
pull: default
image: mysql:8.0
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: xorm_test
when:
event:
- push
- tag
- pull_request
- name: pgsql - name: pgsql
pull: default pull: default
image: postgres:9.5 image: postgres:9.5

View File

@ -6,6 +6,7 @@ package xorm
import ( import (
"errors" "errors"
"sort"
"testing" "testing"
"time" "time"
@ -1141,8 +1142,10 @@ func TestCompositePK(t *testing.T) {
pkCols := table.PKColumns() pkCols := table.PKColumns()
assert.EqualValues(t, 2, len(pkCols)) assert.EqualValues(t, 2, len(pkCols))
assert.EqualValues(t, "uid", pkCols[0].Name)
assert.EqualValues(t, "tid", pkCols[1].Name) names := []string{pkCols[0].Name, pkCols[1].Name}
sort.Strings(names)
assert.EqualValues(t, []string{"tid", "uid"}, names)
} }
func TestNoPKIdQueryUpdate(t *testing.T) { func TestNoPKIdQueryUpdate(t *testing.T) {