Skip to content

Commit b45cddf

Browse files
authored
chore: make sure logging is set properly (#396)
Signed-off-by: Marco Nenciarini <[email protected]>
1 parent a0327ea commit b45cddf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cmd/manager/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ func main() {
2222
logFlags := &log.Flags{}
2323
rootCmd := &cobra.Command{
2424
Use: "manager [cmd]",
25-
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
25+
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
2626
logFlags.ConfigureLogging()
27-
return nil
27+
cmd.SetContext(log.IntoContext(cmd.Context(), log.GetLogger()))
2828
},
2929
}
3030

test/e2e/e2e_suite_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"testing"
2323
"time"
2424

25+
"github.com/cloudnative-pg/machinery/pkg/log"
2526
apimachineryTypes "k8s.io/apimachinery/pkg/types"
2627
"k8s.io/apimachinery/pkg/util/wait"
2728
kustomizeTypes "sigs.k8s.io/kustomize/api/types"
@@ -118,7 +119,10 @@ var _ = SynchronizedBeforeSuite(func(ctx SpecContext) []byte {
118119
}
119120

120121
return []byte{}
121-
}, func(_ []byte) {})
122+
}, func(_ []byte) {
123+
logFlags := &log.Flags{}
124+
logFlags.ConfigureLogging()
125+
})
122126

123127
// Run e2e tests using the Ginkgo runner.
124128
func TestE2E(t *testing.T) {

0 commit comments

Comments
 (0)