Skip to content

Commit 35b2813

Browse files
committed
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
1 parent bc8bb23 commit 35b2813

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

.drone.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,24 @@ steps:
4545
- push
4646
- pull_request
4747

48+
- name: test-mysql8
49+
image: golang:1.12
50+
environment:
51+
GO111MODULE: "on"
52+
GOPROXY: "https://goproxy.cn"
53+
TEST_MYSQL_HOST: mysql8
54+
TEST_MYSQL_CHARSET: utf8mb4
55+
TEST_MYSQL_DBNAME: xorm_test
56+
TEST_MYSQL_USERNAME: root
57+
TEST_MYSQL_PASSWORD:
58+
commands:
59+
- make test-mysql
60+
- TEST_CACHE_ENABLE=true make test-mysql
61+
when:
62+
event:
63+
- push
64+
- pull_request
65+
4866
- name: test-mysql-utf8mb4
4967
image: golang:1.12
5068
depends_on:
@@ -170,6 +188,7 @@ steps:
170188
- test-vet
171189
- test-sqlite
172190
- test-mysql
191+
- test-mysql8
173192
- test-mymysql
174193
- test-postgres
175194
- test-postgres-schema
@@ -196,6 +215,18 @@ services:
196215
- tag
197216
- pull_request
198217

218+
- name: mysql8
219+
pull: default
220+
image: mysql:8.0
221+
environment:
222+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
223+
MYSQL_DATABASE: xorm_test
224+
when:
225+
event:
226+
- push
227+
- tag
228+
- pull_request
229+
199230
- name: pgsql
200231
pull: default
201232
image: postgres:9.5

session_pk_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package xorm
66

77
import (
88
"errors"
9+
"sort"
910
"testing"
1011
"time"
1112

@@ -1141,8 +1142,10 @@ func TestCompositePK(t *testing.T) {
11411142

11421143
pkCols := table.PKColumns()
11431144
assert.EqualValues(t, 2, len(pkCols))
1144-
assert.EqualValues(t, "uid", pkCols[0].Name)
1145-
assert.EqualValues(t, "tid", pkCols[1].Name)
1145+
1146+
names := []string{pkCols[0].Name, pkCols[1].Name}
1147+
sort.Strings(names)
1148+
assert.EqualValues(t, []string{"tid", "uid"}, names)
11461149
}
11471150

11481151
func TestNoPKIdQueryUpdate(t *testing.T) {

0 commit comments

Comments
 (0)