| 1 |
From: Martina Ferrari <[email protected]> |
| 2 |
Date: Fri, 7 Mar 2025 20:29:22 +0000 |
| 3 |
Subject: Avoid non-recoverable panic in test |
| 4 |
|
| 5 |
Since go 1.24 crypto/rand throws a non-recoverable fatal error when it |
| 6 |
fails to read random data, so this test needs to be disabled. |
| 7 |
See https://go.dev/issue/66821 |
| 8 |
|
| 9 |
Forwarded: https://github.com/gorilla/csrf/issues/183 |
| 10 |
--- |
| 11 |
helpers_test.go | 8 ++++++-- |
| 12 |
1 file changed, 6 insertions(+), 2 deletions(-) |
| 13 |
|
| 14 |
diff --git a/helpers_test.go b/helpers_test.go |
| 15 |
index 399db8d..285cd5c 100644 |
| 16 |
--- a/helpers_test.go |
| 17 |
+++ b/helpers_test.go |
| 18 |
@@ -2,10 +2,8 @@ package csrf |
| 19 |
|
| 20 |
import ( |
| 21 |
"bytes" |
| 22 |
- "crypto/rand" |
| 23 |
"encoding/base64" |
| 24 |
"fmt" |
| 25 |
- "io" |
| 26 |
"log" |
| 27 |
"mime/multipart" |
| 28 |
"net/http" |
| 29 |
@@ -204,6 +202,11 @@ func TestXOR(t *testing.T) { |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
+// Since go 1.24 crypto/rand throws a non-recoverable fatal error when it fails |
| 34 |
+// to read random data, so this test needs to be disabled. |
| 35 |
+// See https://go.dev/issue/66821 |
| 36 |
+ |
| 37 |
+/* |
| 38 |
// shortReader provides a broken implementation of io.Reader for testing. |
| 39 |
type shortReader struct{} |
| 40 |
|
| 41 |
@@ -226,6 +229,7 @@ func TestGenerateRandomBytes(t *testing.T) { |
| 42 |
t.Fatalf("generateRandomBytes did not report a short read: only read %d bytes", len(b)) |
| 43 |
} |
| 44 |
} |
| 45 |
+*/ |
| 46 |
|
| 47 |
func TestTemplateField(t *testing.T) { |
| 48 |
s := http.NewServeMux() |