Skip to content

Commit

Permalink
Remove testing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
theseanything committed Dec 11, 2024
1 parent a338f18 commit 7e31a72
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 110 deletions.
10 changes: 1 addition & 9 deletions integration_tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ func TestEverything(t *testing.T) {

var _ = BeforeSuite(func() {
runtime.GOMAXPROCS(runtime.NumCPU())
err := setupTempLogfile()
if err != nil {
Fail(err.Error())
}
var err error

ctx := context.Background()

Expand All @@ -45,12 +42,7 @@ var _ = BeforeSuite(func() {
}
})

var _ = BeforeEach(func() {
resetTempLogfile()
})

var _ = AfterSuite(func() {
stopRouter(routerPort)
cleanupPostgresContainer()
cleanupTempLogfile()
})
31 changes: 0 additions & 31 deletions integration_tests/proxy_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ var _ = Describe("Functioning as a reverse proxy", func() {

resp := doRequest(req)
Expect(resp.StatusCode).To(Equal(502))

logDetails := lastRouterErrorLogEntry()
Expect(logDetails.Fields).To(Equal(map[string]interface{}{
"error": "dial tcp 127.0.0.1:6803: connect: connection refused",
"request": "GET /not-running HTTP/1.1",
"request_method": "GET",
"status": float64(502), // All numbers in JSON are floating point
"upstream_addr": "127.0.0.1:6803",
}))
Expect(logDetails.Timestamp).To(BeTemporally("~", time.Now(), time.Second))
})

It("should log and return a 504 if the connection times out in the configured time", func() {
Expand All @@ -56,16 +46,6 @@ var _ = Describe("Functioning as a reverse proxy", func() {

Expect(resp.StatusCode).To(Equal(504))
Expect(duration).To(BeNumerically("~", 320*time.Millisecond, 20*time.Millisecond)) // 300 - 340 ms

logDetails := lastRouterErrorLogEntry()
Expect(logDetails.Fields).To(Equal(map[string]interface{}{
"error": "dial tcp 240.0.0.0:1234: i/o timeout",
"request": "GET /should-time-out HTTP/1.1",
"request_method": "GET",
"status": float64(504), // All numbers in JSON are floating point
"upstream_addr": "240.0.0.0:1234",
}))
Expect(logDetails.Timestamp).To(BeTemporally("~", time.Now(), time.Second))
})

Describe("response header timeout", func() {
Expand All @@ -91,17 +71,6 @@ var _ = Describe("Functioning as a reverse proxy", func() {
req := newRequest(http.MethodGet, routerURL(3167, "/tarpit1"))
resp := doRequest(req)
Expect(resp.StatusCode).To(Equal(504))

logDetails := lastRouterErrorLogEntry()
tarpitURL, _ := url.Parse(tarpit1.URL)
Expect(logDetails.Fields).To(Equal(map[string]interface{}{
"error": "net/http: timeout awaiting response headers",
"request": "GET /tarpit1 HTTP/1.1",
"request_method": "GET",
"status": float64(504), // All numbers in JSON are floating point
"upstream_addr": tarpitURL.Host,
}))
Expect(logDetails.Timestamp).To(BeTemporally("~", time.Now(), time.Second))
})

It("should still return the response if the body takes longer than the header timeout", func() {
Expand Down
69 changes: 0 additions & 69 deletions integration_tests/router_logging.go

This file was deleted.

1 change: 0 additions & 1 deletion integration_tests/router_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func startRouter(port, apiPort int, extraEnv []string) error {

cmd.Env = append(cmd.Env, fmt.Sprintf("ROUTER_PUBADDR=%s", pubAddr))
cmd.Env = append(cmd.Env, fmt.Sprintf("ROUTER_APIADDR=%s", apiAddr))
cmd.Env = append(cmd.Env, fmt.Sprintf("ROUTER_ERROR_LOG=%s", tempLogfile.Name()))
cmd.Env = append(cmd.Env, "CONTENT_STORE_DATABASE_URL="+postgresContainer.MustConnectionString(context.Background()))
cmd.Env = append(cmd.Env, extraEnv...)

Expand Down

0 comments on commit 7e31a72

Please sign in to comment.