fix test failures caused by dep bump and update replace statements

This commit is contained in:
Ryan Richard
2024-05-01 11:01:13 -07:00
parent 070819754f
commit 0a63dd104d
5 changed files with 63 additions and 12 deletions

View File

@@ -0,0 +1,32 @@
// Copyright 2024 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package testutil
import (
"strconv"
"testing"
"github.com/stretchr/testify/require"
"k8s.io/component-base/logs"
"k8s.io/klog/v2"
)
// Deprecated: This is meant for old tests only.
func SetGlobalKlogLevel(t *testing.T, l klog.Level) {
t.Helper()
_, err := logs.GlogSetter(strconv.Itoa(int(l)))
require.NoError(t, err)
}
func GetGlobalKlogLevel() klog.Level {
// hack around klog not exposing a Get method
for i := klog.Level(0); i < 256; i++ {
if klog.V(i).Enabled() {
continue
}
return i - 1
}
return -1
}