From ab2ba8400d67a3a0734fc18c830957b5a9f896cc Mon Sep 17 00:00:00 2001 From: Leonid Bugaev Date: Sat, 6 Jun 2020 17:07:51 +0300 Subject: [PATCH] Improve S3 debugging --- Makefile | 2 +- input_file.go | 7 +++++++ input_file_test.go | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b51d2cc..9c141b5 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ test_all: $(RUN) go test ./... -timeout 120s $(LDFLAGS) $(ARGS) -v testone: - $(RUN) go test ./... -timeout 4s $(LDFLAGS) -run $(TEST) $(ARGS) -v + $(RUN) go test ./. -timeout 60s $(LDFLAGS) -run $(TEST) $(ARGS) -v cover: $(RUN) go test $(ARGS) -race -v -timeout 15s -coverprofile=coverage.out diff --git a/input_file.go b/input_file.go index e69abc3..afb218a 100644 --- a/input_file.go +++ b/input_file.go @@ -41,10 +41,17 @@ func awsConfig() *aws.Config { if endpoint := os.Getenv("AWS_ENDPOINT_URL"); endpoint != "" { config.Endpoint = aws.String(endpoint) + log.Println("Custom endpoint:", endpoint) } + log.Println("Connecting to S3. Region: " + region) + config.CredentialsChainVerboseErrors = aws.Bool(true) + if os.Getenv("AWS_DEBUG") != "" { + config.LogLevel = aws.LogLevel(aws.LogDebugWithHTTPBody) + } + return config } diff --git a/input_file_test.go b/input_file_test.go index 573b38f..af3a6ca 100644 --- a/input_file_test.go +++ b/input_file_test.go @@ -385,7 +385,7 @@ func Duplicate(data []byte) (duplicate []byte) { func TestInputFileFromS3(t *testing.T) { rnd := rand.Int63() - path := fmt.Sprintf("s3://test-gor/%d/requests.gz", rnd) + path := fmt.Sprintf("s3://test-gor-eu/%d/requests.gz", rnd) output := NewS3Output(path, &FileOutputConfig{queueLimit: 5000}) output.closeC = make(chan struct{}, 10) @@ -404,7 +404,7 @@ func TestInputFileFromS3(t *testing.T) { <-output.closeC } - input := NewFileInput(fmt.Sprintf("s3://test-gor/%d", rnd), false) + input := NewFileInput(fmt.Sprintf("s3://test-gor-eu/%d", rnd), false) buf := make([]byte, 1000) for i := 0; i <= 19999; i++ {