mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
Save http trace to a file (#5300)
Save http trace to a file instead of displaying it onto the console. the environment variable MINIO_HTTP_TRACE will be a filepath instead of a boolean. This to handle the scenario where both json and http tracing are turned on. In that case, both http trace and json output are displayed on the screen making the json not parsable. Loging this trace onto a file helps us avoid that scenario. Fixes #5263
This commit is contained in:
@@ -19,8 +19,10 @@ package cmd
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -50,6 +52,19 @@ func TestCloneHeader(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Tests closing http tracing file.
|
||||
func TestStopHTTPTrace(t *testing.T) {
|
||||
var err error
|
||||
globalHTTPTraceFile, err = ioutil.TempFile("", "")
|
||||
if err != nil {
|
||||
defer os.Remove(globalHTTPTraceFile.Name())
|
||||
stopHTTPTrace()
|
||||
if globalHTTPTraceFile != nil {
|
||||
t.Errorf("globalHTTPTraceFile is not nil, it is expected to be nil")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tests maximum object size.
|
||||
func TestMaxObjectSize(t *testing.T) {
|
||||
sizes := []struct {
|
||||
|
||||
Reference in New Issue
Block a user