Fix syslog test failing due to hardcoded timestamp

This commit is contained in:
Muneeb Ullah Khan
2026-01-07 17:25:54 +05:00
parent 50aa4695be
commit bfab54948b
2 changed files with 15 additions and 5 deletions
+3 -1
View File
@@ -60,7 +60,8 @@ func TestJdbc_Pattern(t *testing.T) {
"jdbc:sqlite:/data/test.db",
"jdbc:oracle:thin:@host:1521:db",
"jdbc:mysql://host:3306/db,other_param",
"jdbc:db2://host:50000/db?param=1"
"jdbc:db2://host:50000/db?param=1",
jdbc:mysql://mysqldev1234.example.com:1234/busmdbdev?user=busmdb_ro&password=abcdefg&useSSL=false
]
}`,
want: []string{
@@ -70,6 +71,7 @@ func TestJdbc_Pattern(t *testing.T) {
"jdbc:oracle:thin:@host:1521:db",
"jdbc:mysql://host:3306/db",
"jdbc:db2://host:50000/db?param=1",
"jdbc:mysql://mysqldev1234.example.com:1234/busmdbdev?user=busmdb_ro&password=abcdefg&useSSL=false",
},
},
{
+12 -4
View File
@@ -3,6 +3,7 @@ package syslog
import (
"reflect"
"testing"
"time"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/types/known/anypb"
@@ -74,10 +75,17 @@ func TestSource_parseSyslogMetadata(t *testing.T) {
want: &source_metadatapb.MetaData{
Data: &source_metadatapb.MetaData_Syslog{
Syslog: &source_metadatapb.Syslog{
Hostname: "mymachine",
Timestamp: "2025-10-11 22:14:15 +0000 UTC",
Client: "127.0.0.1:5140",
Facility: "4",
Hostname: "mymachine",
Timestamp: time.Date(
time.Now().Year(),
time.October,
11,
22, 14, 15,
0,
time.UTC,
).String(),
Client: "127.0.0.1:5140",
Facility: "4",
},
},
},