func TestHappyRead(t *testing.T) { // register the modules modprobe.Install("mod_mock", NewModMock) input := []byte(` {"id": "getping", "method": "GET", "enabled": true, "pattern": "/ping/:hola", "chain": [ {"ref": "mod_mock", "params": { "optiona1": "a1", "optiona2": "a2"}}, {"ref": "mod_mock", "params": { "optiona1": "b1"} } ] }`) p, err := newProxyFromJson(input) assert.Nil(t, err) assert.Equal(t, p.GetId(), "getping") assert.Equal(t, p.GetMethod(), "GET") assert.Equal(t, p.IsEnabled(), true) assert.Equal(t, p.GetPattern(), "/ping/:hola") assert.Equal(t, len(p.GetChain().GetModules()), 2) modType := reflect.TypeOf(p.GetChain().GetModules()[0]) fmt.Printf("All: %+v\n", modType) fmt.Printf("Name: %s\n", modType.Name()) fmt.Printf("Pkg: %s\n", modType.PkgPath()) fmt.Printf("Kind: %s\n", modType.Kind()) }
func init() { modprobe.Install("mod_exec", NewExec) }
func init() { modprobe.Install("mod_access", NewAccess) }
func init() { modprobe.Install("mod_rewrite", NewRewrite) }
func init() { modprobe.Install("mod_http_lb", NewHttpLoadbalancer) }
func init() { modprobe.Install("mod_basic_auth", NewBasicAuth) }
func init() { modprobe.Install("mod_docker", NewDocker) }