From 50df84eec973e7b482a47515f59c4b8876211740 Mon Sep 17 00:00:00 2001
From: 6543 <6543@obermui.de>
Date: Fri, 10 Jun 2022 19:47:52 +0200
Subject: [PATCH] use zerolog for integrationtests too

---
 integration/get_test.go  |  6 +++---
 integration/main_test.go | 11 ++++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/integration/get_test.go b/integration/get_test.go
index 11ff951..e5fc279 100644
--- a/integration/get_test.go
+++ b/integration/get_test.go
@@ -4,16 +4,16 @@ import (
 	"bytes"
 	"crypto/tls"
 	"io"
-	"log"
 	"net/http"
 	"net/http/cookiejar"
 	"testing"
 
+	"github.com/rs/zerolog/log"
 	"github.com/stretchr/testify/assert"
 )
 
 func TestGetRedirect(t *testing.T) {
-	log.Println("== TestGetRedirect ==")
+	log.Printf("== TestGetRedirect ==\n")
 	// test custom domain redirect
 	resp, err := getTestHTTPSClient().Get("https://calciumdibromid.localhost.mock.directory:4430")
 	assert.NoError(t, err)
@@ -25,7 +25,7 @@ func TestGetRedirect(t *testing.T) {
 }
 
 func TestGetContent(t *testing.T) {
-	log.Println("== TestGetContent ==")
+	log.Printf("== TestGetContent ==\n")
 	// test get image
 	resp, err := getTestHTTPSClient().Get("https://magiclike.localhost.mock.directory:4430/images/827679288a.jpg")
 	assert.NoError(t, err)
diff --git a/integration/main_test.go b/integration/main_test.go
index fa5c55a..ee4d2ff 100644
--- a/integration/main_test.go
+++ b/integration/main_test.go
@@ -2,24 +2,25 @@ package integration
 
 import (
 	"context"
-	"log"
 	"os"
 	"testing"
 	"time"
 
 	"codeberg.org/codeberg/pages/cmd"
+
+	"github.com/rs/zerolog/log"
 	"github.com/urfave/cli/v2"
 )
 
 func TestMain(m *testing.M) {
-	log.Println("=== TestMain: START Server ==")
+	log.Printf("=== TestMain: START Server ==\n")
 	serverCtx, serverCancel := context.WithCancel(context.Background())
 	if err := startServer(serverCtx); err != nil {
-		log.Fatalf("could not start server: %v", err)
+		log.Fatal().Msgf("could not start server: %v", err)
 	}
 	defer func() {
 		serverCancel()
-		log.Println("=== TestMain: Server STOPED ==")
+		log.Printf("=== TestMain: Server STOPED ==\n")
 	}()
 
 	time.Sleep(30 * time.Second)
@@ -46,7 +47,7 @@ func startServer(ctx context.Context) error {
 
 	go func() {
 		if err := app.RunContext(ctx, args); err != nil {
-			log.Fatalf("run server error: %v", err)
+			log.Fatal().Msgf("run server error: %v", err)
 		}
 	}()