mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
logs: consolidate unit tests
TestFlags got superseded by TestFlagSet/pflag in
8251a63269
.
This commit is contained in:
parent
d627b1686c
commit
6f3e5e30e5
@ -32,23 +32,6 @@ import (
|
|||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFlags(t *testing.T) {
|
|
||||||
c := NewLoggingConfiguration()
|
|
||||||
fs := pflag.NewFlagSet("addflagstest", pflag.ContinueOnError)
|
|
||||||
output := bytes.Buffer{}
|
|
||||||
AddFlags(c, fs)
|
|
||||||
fs.SetOutput(&output)
|
|
||||||
fs.PrintDefaults()
|
|
||||||
want := ` --log-flush-frequency duration Maximum number of seconds between log flushes (default 5s)
|
|
||||||
--logging-format string Sets the log format. Permitted formats: "text". (default "text")
|
|
||||||
-v, --v Level number for the log level verbosity
|
|
||||||
--vmodule pattern=N,... comma-separated list of pattern=N settings for file-filtered logging (only works for text log format)
|
|
||||||
`
|
|
||||||
if !assert.Equal(t, want, output.String()) {
|
|
||||||
t.Errorf("Wrong list of flags. expect %q, got %q", want, output.String())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestOptions(t *testing.T) {
|
func TestOptions(t *testing.T) {
|
||||||
newOptions := NewLoggingConfiguration()
|
newOptions := NewLoggingConfiguration()
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user