-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request help: bare net/http
pkg would always return "404 Route not found"
#1388
Comments
net/http
pkg would always return "404 Route not found"net/http
pkg would always return "404 Route not found"
Hi @Yiyiyimu,
|
@Yiyiyimu you could set |
Thanks for the suggestions @nic-chen !! But it seems still not works... I just found out dashboard e2e test has almost the same function, I'll have a test to see if it works |
Thanks for the suggestions @starsz!
func getWithoutTest(g *WithT, path string, headers map[string]string) string {
client := &http.Client{}
url := host + path
req, err := http.NewRequest(http.MethodGet, url, nil)
g.Expect(err).To(BeNil())
for key, value := range headers {
req.Header.Add(key, value)
}
resp, err := client.Do(req)
g.Expect(err).To(BeNil())
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
g.Expect(err).To(BeNil())
return string(body)
}
|
Sorry I made a mistake, Done. Now it print no logs at all. Thanks for the suggestions! |
The problem is actually about chaos test for apisix, but since it's more about a golang problem and it highly takes e2e test in apisix-dashboard for reference, so I think maybe I'll get more help here.
Background
To test if chaos effect qps of apisix, I try to visit a route in the same frequency, calculate ingress bandwidth per second from prometheus metrics, and then compare before and after the chaos take effect. Ref: apache/apisix#3404
Problem
The current implementation is using
httpexpect
to visit the route. While it's not satisfactory, since it would print one log each time a request sent so it would print a lot logs and make test log into a mess (commit and messy log). So a bare HTTP get would be better.However for some reason, using bare
net/http
pkg to access the route would always return "404 Route not found", although the route is created, accessing the same URL withhttpexpect
could work(commit). So the next check would fail,getIngressBandwidthPerSecond
would return 0 since no request succeeds (see ci error).It would be great if anyone could help me out 🥺
The text was updated successfully, but these errors were encountered: