move struct definition

Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
pull/2955/head
Somtochi Onyekwere 2 years ago
parent 96afee996a
commit 0cfdc5d674

@ -277,7 +277,6 @@ func logRequest(ctx context.Context, request rest.ResponseWrapper, w io.Writer)
} }
func filterPrintLog(t *template.Template, l *ControllerLogEntry, w io.Writer) { func filterPrintLog(t *template.Template, l *ControllerLogEntry, w io.Writer) {
//fmt.
if (logsArgs.logLevel == "" || logsArgs.logLevel == l.Level) && if (logsArgs.logLevel == "" || logsArgs.logLevel == l.Level) &&
(logsArgs.kind == "" || strings.EqualFold(logsArgs.kind, l.Kind)) && (logsArgs.kind == "" || strings.EqualFold(logsArgs.kind, l.Kind)) &&
(logsArgs.name == "" || strings.EqualFold(logsArgs.name, l.Name)) && (logsArgs.name == "" || strings.EqualFold(logsArgs.name, l.Name)) &&

@ -94,17 +94,6 @@ var testPodLogs = `{"level":"info","ts":"2022-08-02T12:55:34.419Z","logger":"con
{"level":"info","ts":"2022-08-02T12:56:34.961Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","reconciler group":"source.toolkit.fluxcd.io","reconciler kind":"GitRepository","name":"podinfo","namespace":"default"} {"level":"info","ts":"2022-08-02T12:56:34.961Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","reconciler group":"source.toolkit.fluxcd.io","reconciler kind":"GitRepository","name":"podinfo","namespace":"default"}
{"level":"error","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"podinfo","namespace":"flux-system"}` {"level":"error","ts":"2022-08-02T12:56:34.961Z","logger":"controller.kustomization","msg":"no changes since last reconcilation: observed revision","reconciler group":"kustomize.toolkit.fluxcd.io","reconciler kind":"Kustomization","name":"podinfo","namespace":"flux-system"}`
type testResponseMapper struct {
}
func (t *testResponseMapper) DoRaw(_ context.Context) ([]byte, error) {
return nil, nil
}
func (t *testResponseMapper) Stream(_ context.Context) (io.ReadCloser, error) {
return io.NopCloser(strings.NewReader(testPodLogs)), nil
}
func TestLogRequest(t *testing.T) { func TestLogRequest(t *testing.T) {
mapper := &testResponseMapper{} mapper := &testResponseMapper{}
tests := []struct { tests := []struct {
@ -189,3 +178,14 @@ func TestLogRequest(t *testing.T) {
}) })
} }
} }
type testResponseMapper struct {
}
func (t *testResponseMapper) DoRaw(_ context.Context) ([]byte, error) {
return nil, nil
}
func (t *testResponseMapper) Stream(_ context.Context) (io.ReadCloser, error) {
return io.NopCloser(strings.NewReader(testPodLogs)), nil
}

Loading…
Cancel
Save