chore: make sure logging is set properly (#396)

Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
This commit is contained in:
Marco Nenciarini 2025-06-06 10:55:29 +02:00 committed by GitHub
parent a0327ea574
commit b45cddfc19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -22,9 +22,9 @@ func main() {
logFlags := &log.Flags{}
rootCmd := &cobra.Command{
Use: "manager [cmd]",
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
logFlags.ConfigureLogging()
return nil
cmd.SetContext(log.IntoContext(cmd.Context(), log.GetLogger()))
},
}

View File

@ -22,6 +22,7 @@ import (
"testing"
"time"
"github.com/cloudnative-pg/machinery/pkg/log"
apimachineryTypes "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
kustomizeTypes "sigs.k8s.io/kustomize/api/types"
@ -118,7 +119,10 @@ var _ = SynchronizedBeforeSuite(func(ctx SpecContext) []byte {
}
return []byte{}
}, func(_ []byte) {})
}, func(_ []byte) {
logFlags := &log.Flags{}
logFlags.ConfigureLogging()
})
// Run e2e tests using the Ginkgo runner.
func TestE2E(t *testing.T) {