vartestPodLogs=`{"level":"info","ts":"2022-08-02T12:55:34.419Z","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:04.679Z","logger":"controller.gitrepository","msg":"no changes since last reconcilation: observed revision","reconciler group":"source.toolkit.fluxcd.io","reconciler kind":"GitRepository","name":"flux-system","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":"flux-system","namespace":"flux-system"}
{"level":"info","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":"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"}`
funcTestLogRequest(t*testing.T){
mapper:=&testResponseMapper{}
tests:=[]struct{
namestring
namespacestring
flags*logsFlags
assertFilestring
}{
{
name:"all logs",
flags:&logsFlags{
tail:-1,
allNamespaces:true,
},
assertFile:"testdata/logs/all-logs.txt",
},
{
name:"filter by namespace",
namespace:"default",
flags:&logsFlags{
tail:-1,
},
assertFile:"testdata/logs/namespace.txt",
},
{
name:"filter by kind and namespace",
flags:&logsFlags{
tail:-1,
kind:"Kustomization",
},
assertFile:"testdata/logs/kind.txt",
},
{
name:"filter by loglevel",
flags:&logsFlags{
tail:-1,
logLevel:"error",
allNamespaces:true,
},
assertFile:"testdata/logs/log-level.txt",
},
{
name:"filter by namespace, name, loglevel and kind",