diff --git a/cmd/robot/login.go b/cmd/robot/login.go index 63494f0b2..9d6a98ea5 100644 --- a/cmd/robot/login.go +++ b/cmd/robot/login.go @@ -9,8 +9,10 @@ import ( "log" "time" + "github.com/Pallinder/go-randomdata" jsoniter "github.com/json-iterator/go" "github.com/nacos-group/nacos-sdk-go/util" + "google.golang.org/protobuf/proto" ) type LoginParam struct { @@ -45,6 +47,21 @@ func (r *Robot) AccountLogin() { }, rsp: &pb.UserLoginResp{}, enabled: true, + next: func(rsp proto.Message, handle func(nextCase *TestCase)) { + if _, ok := rsp.(*pb.UserLoginResp); ok { + nick := randomdata.RandStringRunes(5) + handle(&TestCase{ + desc: "创角", + mainType: string(comm.ModuleUser), + subType: user.UserSubTypeCreate, + req: &pb.UserCreateReq{ //设置请求参数 + NickName: "乐谷" + nick, + }, + rsp: &pb.UserCreateResp{}, + enabled: true, + }) + } + }, }, } r.addBuilders(builders) diff --git a/go.mod b/go.mod index 6deb63a2d..dcf8ab70c 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.18 require ( bright v0.0.0 + github.com/Pallinder/go-randomdata v1.2.0 github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 github.com/dengsgo/math-engine v0.0.0-20220213125415-0351c3c75eca github.com/go-playground/validator/v10 v10.10.1 @@ -74,7 +75,6 @@ require ( github.com/hashicorp/serf v0.9.7 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c // indirect - github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/juju/ratelimit v1.0.1 // indirect github.com/julienschmidt/httprouter v1.3.0 // indirect diff --git a/go.sum b/go.sum index 222a87f5b..96d3f1cd2 100644 --- a/go.sum +++ b/go.sum @@ -49,6 +49,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChimeraCoder/gojson v1.1.0/go.mod h1:nYbTQlu6hv8PETM15J927yM0zGj3njIldp72UT1MqSw= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/Pallinder/go-randomdata v1.2.0 h1:DZ41wBchNRb/0GfsePLiSwb0PHZmT67XY00lCDlaYPg= +github.com/Pallinder/go-randomdata v1.2.0/go.mod h1:yHmJgulpD2Nfrm0cR9tI/+oAgRqCQQixsA8HyRZfV9Y= github.com/akutz/memconn v0.1.0 h1:NawI0TORU4hcOMsMr11g7vwlCdkYeLKXBcxWu2W/P8A= github.com/akutz/memconn v0.1.0/go.mod h1:Jo8rI7m0NieZyLI5e2CDlRdRqRRB4S7Xp77ukDjH+Fw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -367,8 +369,6 @@ github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4= github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= -github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= -github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= diff --git a/test/module_test.go b/test/module_test.go deleted file mode 100644 index a6bea40cf..000000000 --- a/test/module_test.go +++ /dev/null @@ -1,2 +0,0 @@ -package test -