diff options
Diffstat (limited to 'plugins/http/tests/plugin_test_old.go')
-rw-r--r-- | plugins/http/tests/plugin_test_old.go | 122 |
1 files changed, 1 insertions, 121 deletions
diff --git a/plugins/http/tests/plugin_test_old.go b/plugins/http/tests/plugin_test_old.go index 1ef7002e..dae18bb4 100644 --- a/plugins/http/tests/plugin_test_old.go +++ b/plugins/http/tests/plugin_test_old.go @@ -348,127 +348,7 @@ package tests // } //} // -//func Test_Service_Middleware(t *testing.T) { -// bkoff := backoff.NewExponentialBackOff() -// bkoff.MaxElapsedTime = time.Second * 15 -// -// err := backoff.Retry(func() error { -// logger, _ := test.NewNullLogger() -// logger.SetLevel(logrus.DebugLevel) -// -// c := service.NewContainer(logger) -// c.Register(ID, &Service{}) -// -// err := c.Init(&testCfg{httpCfg: `{ -// "enable": true, -// "address": ":6032", -// "maxRequestSize": 1024, -// "uploads": { -// "dir": ` + tmpDir() + `, -// "forbid": [] -// }, -// "workers":{ -// "command": "php ../../tests/http/client.php echo pipes", -// "relay": "pipes", -// "pool": { -// "numWorkers": 1, -// "allocateTimeout": 10000000, -// "destroyTimeout": 10000000 -// } -// } -// }`}) -// if err != nil { -// return err -// } -// -// s, st := c.Get(ID) -// assert.NotNil(t, s) -// assert.Equal(t, service.StatusOK, st) -// -// s.(*Service).AddMiddleware(func(f http.HandlerFunc) http.HandlerFunc { -// return func(w http.ResponseWriter, r *http.Request) { -// if r.URL.Path == "/halt" { -// w.WriteHeader(500) -// _, err := w.Write([]byte("halted")) -// if err != nil { -// t.Errorf("error writing the data to the http reply: error %v", err) -// } -// } else { -// f(w, r) -// } -// } -// }) -// -// go func() { -// err := c.Serve() -// if err != nil { -// t.Errorf("serve error: %v", err) -// } -// }() -// time.Sleep(time.Millisecond * 500) -// -// req, err := http.NewRequest("GET", "http://localhost:6032?hello=world", nil) -// if err != nil { -// c.Stop() -// return err -// } -// -// r, err := http.DefaultClient.Do(req) -// if err != nil { -// c.Stop() -// return err -// } -// -// b, err := ioutil.ReadAll(r.Body) -// if err != nil { -// c.Stop() -// return err -// } -// -// assert.Equal(t, 201, r.StatusCode) -// assert.Equal(t, "WORLD", string(b)) -// -// err = r.Body.Close() -// if err != nil { -// c.Stop() -// return err -// } -// -// req, err = http.NewRequest("GET", "http://localhost:6032/halt", nil) -// if err != nil { -// c.Stop() -// return err -// } -// -// r, err = http.DefaultClient.Do(req) -// if err != nil { -// c.Stop() -// return err -// } -// b, err = ioutil.ReadAll(r.Body) -// if err != nil { -// c.Stop() -// return err -// } -// -// assert.Equal(t, 500, r.StatusCode) -// assert.Equal(t, "halted", string(b)) -// -// err = r.Body.Close() -// if err != nil { -// c.Stop() -// return err -// } -// c.Stop() -// -// return nil -// }, bkoff) -// -// if err != nil { -// t.Fatal(err) -// } -// -//} + // //func Test_Service_Listener(t *testing.T) { // bkoff := backoff.NewExponentialBackOff() |