Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
update
  • Loading branch information
daviszhen committed Nov 29, 2024
1 parent 084d4fc commit 0c5126f
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 21 deletions.
76 changes: 76 additions & 0 deletions pkg/frontend/authenticate_test.go

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions pkg/frontend/mysql_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func TestMysqlClientProtocol_Handshake(t *testing.T) {
_, err = toml.DecodeFile("test/system_vars_config.toml", pu.SV)
require.NoError(t, err)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setSessionAlloc("", NewLeakCheckAllocator())
setPu("", pu)

Expand Down Expand Up @@ -200,6 +201,7 @@ func TestKill(t *testing.T) {
pu, err := getParameterUnit("test/system_vars_config.toml", eng, txnClient)
require.NoError(t, err)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
setSessionAlloc("", NewLeakCheckAllocator())
sql1 := "select connection_id();"
Expand Down Expand Up @@ -1310,6 +1312,7 @@ func TestMysqlResultSet(t *testing.T) {
pu, err := getParameterUnit("test/system_vars_config.toml", eng, txnClient)
require.NoError(t, err)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)

noResultSet := make(map[string]bool)
Expand Down Expand Up @@ -1760,6 +1763,7 @@ func Test_writePackets(t *testing.T) {

pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
if err != nil {
Expand Down Expand Up @@ -1815,6 +1819,7 @@ func Test_beginPacket(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -1833,6 +1838,7 @@ func Test_beginPacket(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -1857,6 +1863,7 @@ func Test_beginPacket(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -1880,6 +1887,7 @@ func Test_beginPacket(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -1982,6 +1990,7 @@ func TestSendPrepareResponse(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -2019,6 +2028,7 @@ func TestSendPrepareResponse(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -2054,6 +2064,7 @@ func FuzzParseExecuteData(f *testing.F) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
if err != nil {
Expand Down Expand Up @@ -2180,6 +2191,7 @@ func Test_resultset(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -2201,6 +2213,7 @@ func Test_resultset(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -2222,6 +2235,7 @@ func Test_resultset(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -2246,6 +2260,7 @@ func Test_resultset(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -2270,6 +2285,7 @@ func Test_send_packet(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -2285,6 +2301,7 @@ func Test_send_packet(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand All @@ -2310,6 +2327,7 @@ func Test_analyse320resp(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -2353,6 +2371,7 @@ func Test_analyse320resp(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -2396,6 +2415,7 @@ func Test_analyse41resp(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(tConn, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -2443,6 +2463,7 @@ func Test_analyse41resp(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(tConn, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -2543,6 +2564,7 @@ func Test_handleHandshake(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand Down Expand Up @@ -2578,6 +2600,7 @@ func Test_handleHandshake_Recover(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
if err != nil {
Expand Down Expand Up @@ -2613,6 +2636,7 @@ func TestMysqlProtocolImpl_Close(t *testing.T) {
}
pu := config.NewParameterUnit(sv, nil, nil, nil)
pu.SV.SkipCheckUser = true
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ioses, err := NewIOSession(&testConn{}, pu, "")
convey.ShouldBeNil(err)
Expand Down
10 changes: 8 additions & 2 deletions pkg/frontend/password_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ import (
"time"

"github.com/golang/mock/gomock"
"github.com/prashantv/gostub"
"github.com/stretchr/testify/assert"

"github.com/matrixorigin/matrixone/pkg/config"
"github.com/matrixorigin/matrixone/pkg/container/types"
"github.com/matrixorigin/matrixone/pkg/defines"
"github.com/prashantv/gostub"
"github.com/stretchr/testify/assert"
)

func TestReverseBytes(t *testing.T) {
Expand Down Expand Up @@ -64,6 +65,7 @@ func Test_GetUserPassword(t *testing.T) {

pu := config.NewParameterUnit(&config.FrontendParameters{}, nil, nil, nil)
pu.SV.SetDefaultValues()
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ctx := context.WithValue(context.TODO(), config.ParameterUnitKey, pu)
rm, _ := NewRoutineManager(ctx, "")
Expand Down Expand Up @@ -102,6 +104,7 @@ func Test_CheckPasswordHistoryRule(t *testing.T) {

pu := config.NewParameterUnit(&config.FrontendParameters{}, nil, nil, nil)
pu.SV.SetDefaultValues()
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ctx := context.WithValue(context.TODO(), config.ParameterUnitKey, pu)
rm, _ := NewRoutineManager(ctx, "")
Expand Down Expand Up @@ -143,6 +146,7 @@ func Test_CheckPasswordIntervalRule(t *testing.T) {

pu := config.NewParameterUnit(&config.FrontendParameters{}, nil, nil, nil)
pu.SV.SetDefaultValues()
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ctx := context.WithValue(context.TODO(), config.ParameterUnitKey, pu)
rm, _ := NewRoutineManager(ctx, "")
Expand Down Expand Up @@ -184,6 +188,7 @@ func Test_PasswordVerification(t *testing.T) {

pu := config.NewParameterUnit(&config.FrontendParameters{}, nil, nil, nil)
pu.SV.SetDefaultValues()
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ctx := context.WithValue(context.TODO(), config.ParameterUnitKey, pu)
rm, _ := NewRoutineManager(ctx, "")
Expand Down Expand Up @@ -346,6 +351,7 @@ func Test_checkPasswordReusePolicy(t *testing.T) {

pu := config.NewParameterUnit(&config.FrontendParameters{}, nil, nil, nil)
pu.SV.SetDefaultValues()
pu.SV.KillRountinesInterval = 0
setPu("", pu)
ctx := context.WithValue(context.TODO(), config.ParameterUnitKey, pu)
rm, _ := NewRoutineManager(ctx, "")
Expand Down
Loading

0 comments on commit 0c5126f

Please sign in to comment.