func (s *ApiSuite) makeConnLimit(id string, connections int64, variable string, priority int, f *engine.Frontend) engine.Middleware { cl, err := connlimit.NewConnLimit(connections, variable) if err != nil { panic(err) } return engine.Middleware{ Type: "connlimit", Id: id, Middleware: cl, } }
func (s *EngineSuite) makeConnLimit(id, variable string, conns int64) engine.Middleware { cl, err := connlimit.NewConnLimit(conns, variable) if err != nil { panic(err) } return engine.Middleware{ Id: id, Type: "connlimit", Priority: 1, Middleware: cl, } }
func (s *BackendSuite) MiddlewareFromJSON(c *C) { cl, err := connlimit.NewConnLimit(10, "client.ip") c.Assert(err, IsNil) m := &Middleware{Id: "c1", Type: "connlimit", Middleware: cl} bytes, err := json.Marshal(m) c.Assert(err, IsNil) out, err := MiddlewareFromJSON(bytes, plugin.NewRegistry().GetSpec) c.Assert(err, IsNil) c.Assert(out, NotNil) c.Assert(out, DeepEquals, m) }