Enable access log for default backend
disable log on default_server
This commit is contained in:
parent
c50fe1bc68
commit
8b3702c829
5 changed files with 119 additions and 71 deletions
|
|
@ -98,4 +98,35 @@ var _ = framework.IngressNginxDescribe("Default backend", func() {
|
|||
Expect(resp.StatusCode).Should(Equal(test.Status))
|
||||
}
|
||||
})
|
||||
It("enables access logging for default backend", func() {
|
||||
f.UpdateNginxConfigMapData("enable-access-log-for-default-backend", "true")
|
||||
host := "foo"
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.GetURL(framework.HTTP)+"/somethingOne").
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
||||
Expect(len(errs)).Should(Equal(0))
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||
|
||||
logs, err := f.NginxLogs()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(logs).To(ContainSubstring("/somethingOne"))
|
||||
})
|
||||
|
||||
It("disables access logging for default backend", func() {
|
||||
f.UpdateNginxConfigMapData("enable-access-log-for-default-backend", "false")
|
||||
host := "bar"
|
||||
resp, _, errs := gorequest.New().
|
||||
Get(f.GetURL(framework.HTTP)+"/somethingTwo").
|
||||
Set("Host", host).
|
||||
End()
|
||||
|
||||
Expect(len(errs)).Should(Equal(0))
|
||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||
|
||||
logs, err := f.NginxLogs()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(logs).ToNot(ContainSubstring("/somethingTwo"))
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue