summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-02-06 03:50:24 +0700
committerShulhan <ms@kilabit.info>2026-02-06 03:50:24 +0700
commita3c27356bfe3e56809f579b617e02829a7ea0a68 (patch)
treeef49c89bb4a404c0fae2ca5b6681969aef15be17
parentc572a44dddf25e07f2f25cc6004370ad505f3ded (diff)
downloadawwan-a3c27356bfe3e56809f579b617e02829a7ea0a68.tar.xz
all: use space log prefix instead of dummy date
Using dummy date make the test output hard to read in verbose option, because the program logs mixed with the test logs.
-rw-r--r--awwan_test.go3
-rw-r--r--exec_request.go4
-rw-r--r--testdata/http_server/execute/cancel_test.data6
-rw-r--r--testdata/http_server/execute/local_test.data6
-rw-r--r--testdata/local/cancel_test.data4
-rw-r--r--testdata/local/local_encrypted.data16
-rw-r--r--testdata/local/local_test.data14
-rw-r--r--testdata/play/awwanssh.test/play_test.data12
8 files changed, 34 insertions, 31 deletions
diff --git a/awwan_test.go b/awwan_test.go
index 2256c5d..3ac1c73 100644
--- a/awwan_test.go
+++ b/awwan_test.go
@@ -12,7 +12,8 @@ import (
)
func TestMain(m *testing.M) {
- defLogTimeFormat = `----/--/-- --:--:--`
+ defLogTimeFormat = ``
+ defLogPrefix = ` `
timeNow = func() time.Time {
return time.Date(2023, time.November, 26, 15, 21, 00, 00, time.UTC)
diff --git a/exec_request.go b/exec_request.go
index 4e6721c..78d6670 100644
--- a/exec_request.go
+++ b/exec_request.go
@@ -16,6 +16,8 @@ import (
// This is set as variable to make it easy overwriting it in testing.
var defLogTimeFormat = `2006/01/02 15:04:05`
+var defLogPrefix = ``
+
// ExecRequest request for executing local or remote script.
// Each request define the Mode of execution, Script file to be executed,
// and the lineRange -- list of line numbers to be executed.
@@ -84,7 +86,7 @@ func (req *ExecRequest) init(workDir string) (err error) {
namedStderr = mlog.NewNamedWriter(`stderr`, os.Stderr)
)
- req.mlog = mlog.NewMultiLogger(defLogTimeFormat, ``,
+ req.mlog = mlog.NewMultiLogger(defLogTimeFormat, defLogPrefix,
[]mlog.NamedWriter{namedStdout},
[]mlog.NamedWriter{namedStderr},
)
diff --git a/testdata/http_server/execute/cancel_test.data b/testdata/http_server/execute/cancel_test.data
index 4611da6..edf21f9 100644
--- a/testdata/http_server/execute/cancel_test.data
+++ b/testdata/http_server/execute/cancel_test.data
@@ -30,15 +30,15 @@ event: begin
data: "2023-11-26T15:21:00Z"
event: message
-data: "----/--/-- --:--:-- === BEGIN: local /cancel.aww 1-\n"
+data: " === BEGIN: local /cancel.aww 1-\n"
id: 0
event: message
-data: "----/--/-- --:--:-- --> 1: sleep 300\n"
+data: " --> 1: sleep 300\n"
id: 1
event: message
-data: "----/--/-- --:--:-- !!! ExecLocal: signal: killed\n"
+data: " !!! ExecLocal: signal: killed\n"
id: 2
event: message
diff --git a/testdata/http_server/execute/local_test.data b/testdata/http_server/execute/local_test.data
index d58e0cb..5f96637 100644
--- a/testdata/http_server/execute/local_test.data
+++ b/testdata/http_server/execute/local_test.data
@@ -28,11 +28,11 @@ event: begin
data: "2023-11-26T15:21:00Z"
event: message
-data: "----/--/-- --:--:-- === BEGIN: local /local.aww 1-\n"
+data: " === BEGIN: local /local.aww 1-\n"
id: 0
event: message
-data: "----/--/-- --:--:-- --> 1: echo \"test\"\n"
+data: " --> 1: echo \"test\"\n"
id: 1
event: message
@@ -40,7 +40,7 @@ data: "test\n"
id: 2
event: message
-data: "----/--/-- --:--:-- === END: local /local.aww 1-\n"
+data: " === END: local /local.aww 1-\n"
id: 3
event: end
diff --git a/testdata/local/cancel_test.data b/testdata/local/cancel_test.data
index 357ec8b..cdd9f44 100644
--- a/testdata/local/cancel_test.data
+++ b/testdata/local/cancel_test.data
@@ -1,3 +1,3 @@
<<< cancel
-----/--/-- --:--:-- === BEGIN: local testdata/local/cancel.aww 1
-----/--/-- --:--:-- --> 1: sleep 300
+ === BEGIN: local testdata/local/cancel.aww 1
+ --> 1: sleep 300
diff --git a/testdata/local/local_encrypted.data b/testdata/local/local_encrypted.data
index 045e884..ad9b375 100644
--- a/testdata/local/local_encrypted.data
+++ b/testdata/local/local_encrypted.data
@@ -1,7 +1,7 @@
<<< echo_encrypted:stdout
-----/--/-- --:--:-- === BEGIN: local testdata/local/local_encrypted.aww 3
-----/--/-- --:--:-- --> 3: echo this_is_a_secret
-----/--/-- --:--:-- === END: local testdata/local/local_encrypted.aww 3
+ === BEGIN: local testdata/local/local_encrypted.aww 3
+ --> 3: echo this_is_a_secret
+ === END: local testdata/local/local_encrypted.aww 3
<<< echo_encrypted:stderr
this_is_a_secret
@@ -11,7 +11,7 @@ this_is_a_secret
Local: NewScript: ParseScript: template: local_encrypted.aww:3:7: executing "local_encrypted.aww" at <.Val>: error calling Val: "secret::pass" is empty
<<< echo_encrypted_no_pass:stderr
-----/--/-- --:--:-- !!! NewScript: ParseScript: template: local_encrypted.aww:3:7: executing "local_encrypted.aww" at <.Val>: error calling Val: "secret::pass" is empty
+ !!! NewScript: ParseScript: template: local_encrypted.aww:3:7: executing "local_encrypted.aww" at <.Val>: error calling Val: "secret::pass" is empty
<<< echo_encrypted_no_pass:stdout
@@ -19,7 +19,7 @@ Local: NewScript: ParseScript: template: local_encrypted.aww:3:7: executing "loc
Local: NewSession: .awwan.env.vault: LoadPrivateKeyInteractive: x509: decryption password incorrect
<<< echo_encrypted_invalid_pass:stderr
-----/--/-- --:--:-- !!! NewSession: .awwan.env.vault: LoadPrivateKeyInteractive: x509: decryption password incorrect
+ !!! NewSession: .awwan.env.vault: LoadPrivateKeyInteractive: x509: decryption password incorrect
<<< echo_encrypted_invalid_pass:stdout
@@ -30,6 +30,6 @@ this_is_a_secret_in_sub
<<< sub_echo_encrypted:stdout
-----/--/-- --:--:-- === BEGIN: local testdata/local/sub/local_encrypted.aww 1
-----/--/-- --:--:-- --> 1: echo this_is_a_secret_in_sub
-----/--/-- --:--:-- === END: local testdata/local/sub/local_encrypted.aww 1
+ === BEGIN: local testdata/local/sub/local_encrypted.aww 1
+ --> 1: echo this_is_a_secret_in_sub
+ === END: local testdata/local/sub/local_encrypted.aww 1
diff --git a/testdata/local/local_test.data b/testdata/local/local_test.data
index 5d1ce26..92d4f42 100644
--- a/testdata/local/local_test.data
+++ b/testdata/local/local_test.data
@@ -7,14 +7,14 @@ local
<<< [stdout] local.aww 1-
-----/--/-- --:--:-- === BEGIN: local testdata/local/local.aww 1-
-----/--/-- --:--:-- --> 1: echo "hello"
-----/--/-- --:--:-- --> 3: #local: echo "nothing"
-----/--/-- --:--:-- --> 5: echo "local"
-----/--/-- --:--:-- === END: local testdata/local/local.aww 1-
+ === BEGIN: local testdata/local/local.aww 1-
+ --> 1: echo "hello"
+ --> 3: #local: echo "nothing"
+ --> 5: echo "local"
+ === END: local testdata/local/local.aww 1-
<<< [stderr] local.aww 100-
<<< [stdout] local.aww 100-
-----/--/-- --:--:-- === BEGIN: local testdata/local/local.aww 100-
-----/--/-- --:--:-- === END: local testdata/local/local.aww 100-
+ === BEGIN: local testdata/local/local.aww 100-
+ === END: local testdata/local/local.aww 100-
diff --git a/testdata/play/awwanssh.test/play_test.data b/testdata/play/awwanssh.test/play_test.data
index 46445e8..e67163f 100644
--- a/testdata/play/awwanssh.test/play_test.data
+++ b/testdata/play/awwanssh.test/play_test.data
@@ -1,11 +1,11 @@
Test on "play" command.
<<< play_with_local:output
-----/--/-- --:--:-- --- SSH connection: awwanssh@127.0.0.1:10022
-----/--/-- --:--:-- --- SSH identity file: [/home/awwan/.ssh/id_ed25519]
-----/--/-- --:--:-- === BEGIN: play testdata/play/awwanssh.test/play.aww 1-
-----/--/-- --:--:-- --> 2: pwd
+ --- SSH connection: awwanssh@127.0.0.1:10022
+ --- SSH identity file: [/home/awwan/.ssh/id_ed25519]
+ === BEGIN: play testdata/play/awwanssh.test/play.aww 1-
+ --> 2: pwd
/home/awwanssh
-----/--/-- --:--:-- --> 5: #local: pwd
+ --> 5: #local: pwd
/home/awwan/src
-----/--/-- --:--:-- === END: play testdata/play/awwanssh.test/play.aww 1-
+ === END: play testdata/play/awwanssh.test/play.aww 1-