v0.23.0 color, presets, certificates made at startup, cli.go, sink flush
This commit is contained in:
1 parent
15745682bc
commit
bf410e1225
50 files changed
+2649
-426
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/lixenwraith/logwisp/internal/config"
|
||||
@@ -19,7 +20,11 @@ func testLogger(t *testing.T) {
|
||||
func loadTestConfig(t *testing.T, path string, args ...string) *config.Config {
|
||||
t.Helper()
|
||||
testutil.ClearEnvPrefix(t, "LOGWISP_")
|
||||
m, err := config.Load(append([]string{"-c", path, "--quiet", "--status_reporter=false"}, args...))
|
||||
inv, err := parseCommandLine(append([]string{"-c", path, "--quiet", "--status_reporter=false"}, args...))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
m, err := config.Load(inv.load)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -30,3 +35,15 @@ func loadTestConfig(t *testing.T, path string, args ...string) *config.Config {
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// runCommand runs `lw NAME ARGS...` and returns its exit status and output
|
||||
func runCommand(t *testing.T, name string, args ...string) (code int, stdout, stderr string) {
|
||||
t.Helper()
|
||||
inv, err := parseCommandLine(append([]string{name}, args...))
|
||||
if err != nil || inv.command == nil {
|
||||
t.Fatalf("lw %s: not a command: %v", name, err)
|
||||
}
|
||||
var out, errOut bytes.Buffer
|
||||
code = inv.command.run(inv.args, &out, &errOut)
|
||||
return code, out.String(), errOut.String()
|
||||
}
|
||||
Reference in new issue
Block a user