Skip to content
Snippets Groups Projects
Commit 2c9d4857 authored by Fabian Seidl's avatar Fabian Seidl
Browse files

workaround for false output of passing getUser test

parent b7ed7f6e
No related branches found
No related tags found
1 merge request!287Implement data persisting for user management
Pipeline #100062 passed
package server package server
import ( import (
"bytes"
"context" "context"
"log"
"reflect" "reflect"
"testing" "testing"
...@@ -150,6 +152,7 @@ func TestAuth_CreateUsers(t *testing.T) { ...@@ -150,6 +152,7 @@ func TestAuth_CreateUsers(t *testing.T) {
} }
func TestAuth_GetUser(t *testing.T) { func TestAuth_GetUser(t *testing.T) {
patchLogger(t)
type args struct { type args struct {
ctx context.Context ctx context.Context
request *apb.GetUserRequest request *apb.GetUserRequest
...@@ -829,3 +832,16 @@ func createTestRoles() error { ...@@ -829,3 +832,16 @@ func createTestRoles() error {
return nil return nil
} }
func patchLogger(t *testing.T) {
orig := log.Writer()
buf := new(bytes.Buffer)
log.SetOutput(buf)
t.Cleanup(func() {
// optionally check t.Failed here if you only want to print logs on failure
t.Log(buf.String())
log.SetOutput(orig)
})
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment