Skip to content

Commit

Permalink
fix setLogger warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill-Garbar committed Jun 12, 2024
1 parent 7193053 commit 417ec3e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
18 changes: 18 additions & 0 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,31 @@ limitations under the License.
package e2e

import (
"context"
"fmt"
"testing"

"github.com/aenix-io/etcd-operator/internal/log"
"github.com/go-logr/logr"
logctrl "sigs.k8s.io/controller-runtime/pkg/log"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var ctx context.Context

var _ = BeforeSuite(func() {
ctx = log.Setup(context.TODO(), log.Parameters{
LogLevel: "error",
StacktraceLevel: "error",
Development: true,
})

// This line prevents controller-runtime from complaining about log.SetLogger never being called
logctrl.SetLogger(logr.FromContextOrDiscard(ctx))
})

// Run e2e tests using the Ginkgo runner.
func TestE2E(t *testing.T) {
RegisterFailHandler(Fail)
Expand Down
8 changes: 0 additions & 8 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package e2e

import (
"context"
"fmt"
"os"
"os/exec"
Expand All @@ -28,16 +27,9 @@ import (
clientv3 "go.etcd.io/etcd/client/v3"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/aenix-io/etcd-operator/internal/log"
"github.com/aenix-io/etcd-operator/test/utils"
)

var ctx = log.Setup(context.TODO(), log.Parameters{
LogLevel: "error",
StacktraceLevel: "error",
Development: true,
})

var _ = Describe("etcd-operator", Ordered, func() {

BeforeAll(func() {
Expand Down

0 comments on commit 417ec3e

Please sign in to comment.