1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
From b451d190b766d7fb5e64c7f1cedde314b02e1f0c Mon Sep 17 00:00:00 2001
From: Manuel Sabban <github@sabban.eu>
Date: Mon, 13 Mar 2023 17:26:33 +0100
Subject: [PATCH] try to make reproducible build work (#2119)
Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
---
.../modules/syslog/internal/parser/rfc3164/parse_test.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pkg/acquisition/modules/syslog/internal/parser/rfc3164/parse_test.go b/pkg/acquisition/modules/syslog/internal/parser/rfc3164/parse_test.go
index bef3bde3..48772d59 100644
--- a/pkg/acquisition/modules/syslog/internal/parser/rfc3164/parse_test.go
+++ b/pkg/acquisition/modules/syslog/internal/parser/rfc3164/parse_test.go
@@ -1,6 +1,7 @@
package rfc3164
import (
+ "fmt"
"testing"
"time"
)
@@ -47,6 +48,7 @@ func TestPri(t *testing.T) {
}
func TestTimestamp(t *testing.T) {
+
tests := []struct {
input string
expected string
@@ -54,7 +56,7 @@ func TestTimestamp(t *testing.T) {
currentYear bool
}{
{"May 20 09:33:54", "0000-05-20T09:33:54Z", "", false},
- {"May 20 09:33:54", "2023-05-20T09:33:54Z", "", true},
+ {"May 20 09:33:54", fmt.Sprintf("%d-05-20T09:33:54Z", time.Now().Year()), "", true},
{"May 20 09:33:54 2022", "2022-05-20T09:33:54Z", "", false},
{"May 1 09:33:54 2022", "2022-05-01T09:33:54Z", "", false},
{"May 01 09:33:54 2021", "2021-05-01T09:33:54Z", "", true},
@@ -257,7 +259,7 @@ func TestParse(t *testing.T) {
},
{
"<12>May 20 09:33:54 UDMPRO,a2edd0c6ae48,udm-1.10.0.3686 kernel: foo", expected{
- Timestamp: time.Date(2023, time.May, 20, 9, 33, 54, 0, time.UTC),
+ Timestamp: time.Date(time.Now().Year(), time.May, 20, 9, 33, 54, 0, time.UTC),
Hostname: "UDMPRO,a2edd0c6ae48,udm-1.10.0.3686",
Tag: "kernel",
PID: "",
--
2.30.2
|