From a4bf3113e62ecfb74ab2c89f1cdfc7375af1c59e Mon Sep 17 00:00:00 2001 From: Shulhan Date: Tue, 3 Feb 2026 20:32:57 +0700 Subject: all: fix data race in tests and [httpServer.ExecuteTail] In the test for AwwanLocal, use buffer with lock, so each write and read is safe. In the httpServer, the test found data race during ExecuteTail when accessing [ExecResponse.EndAt]. We fix it by locking the resource during call to end() and when accessing the EndAt field. --- testdata/local/local_encrypted.data | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'testdata') diff --git a/testdata/local/local_encrypted.data b/testdata/local/local_encrypted.data index 3d523a0..045e884 100644 --- a/testdata/local/local_encrypted.data +++ b/testdata/local/local_encrypted.data @@ -1,23 +1,35 @@ -<<< echo_encrypted +<<< echo_encrypted:stdout ----/--/-- --:--:-- === BEGIN: local testdata/local/local_encrypted.aww 3 ----/--/-- --:--:-- --> 3: echo this_is_a_secret -this_is_a_secret ----/--/-- --:--:-- === END: local testdata/local/local_encrypted.aww 3 -<<< echo_encrypted_no_pass +<<< echo_encrypted:stderr +this_is_a_secret + + +<<< echo_encrypted_no_pass:error 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:output +<<< 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 -<<< echo_encrypted_invalid_pass +<<< echo_encrypted_no_pass:stdout + +<<< echo_encrypted_invalid_pass:error Local: NewSession: .awwan.env.vault: LoadPrivateKeyInteractive: x509: decryption password incorrect -<<< echo_encrypted_invalid_pass:output +<<< echo_encrypted_invalid_pass:stderr ----/--/-- --:--:-- !!! NewSession: .awwan.env.vault: LoadPrivateKeyInteractive: x509: decryption password incorrect -<<< sub_echo_encrypted +<<< echo_encrypted_invalid_pass:stdout + +<<< sub_echo_encrypted:error + +<<< sub_echo_encrypted:stderr +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 -this_is_a_secret_in_sub ----/--/-- --:--:-- === END: local testdata/local/sub/local_encrypted.aww 1 -- cgit v1.3