v0.30.0 lw --tui, compose pipeline on screen

This commit is contained in:
lixen committed 2026-10-09 19:30:50 -04:00
1 parent 2d72772943
commit 883af0fcaa
20 files changed
+2442 -69

No files matched your search

+28
View File
@@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"reflect"
"slices"
"strings"
"testing"
"time"
@@ -290,6 +291,33 @@ func TestNoConfigFileMeansQuietLogging(t *testing.T) {
}
}
// The pipelines are lw's built-in pipe only when no file, flag or variable
// defined one: a file of settings alone runs the pipe
func TestBuiltInPipeIsWhatNothingNamed(t *testing.T) {
isolateConfig(t)
builtIn := func(args Args) bool {
t.Helper()
m, err := Load(args)
if err != nil {
t.Fatal(err)
}
defer m.Close()
return m.BuiltIn()
}
named := []bool{builtIn(Args{}), builtIn(Args{Specs: []Spec{{Flag: "source", Value: "null"}}})}
t.Setenv("LOGWISP_SOURCE", "null")
named = append(named, builtIn(Args{}))
t.Setenv("LOGWISP_SOURCE", "")
testutil.WriteFile(t, "logwisp.toml", "[logging]\nlevel = \"warn\"\n")
named = append(named, builtIn(Args{}))
testutil.WriteFile(t, "logwisp.toml", "[[pipelines]]\nname = \"p\"\n"+
"[[pipelines.plugin_sources]]\ntype = \"null\"\n[[pipelines.plugin_sinks]]\ntype = \"null\"\n")
named = append(named, builtIn(Args{}))
if !slices.Equal(named, []bool{true, false, false, true, false}) {
t.Fatalf("nothing, a flag, a variable, a file of settings, a file's pipeline: %v", named)
}
}
// A string in the file is one list entry: split at its comma, an exclude
// pattern such as password=\S{8,64} would become two that match nothing
func TestFileStringIsOneListEntry(t *testing.T) {