From 2638de6aeb6d780a2f51dd78f54e0ef7fcc25a7d Mon Sep 17 00:00:00 2001 From: Matheus Macabu Date: Wed, 5 Mar 2025 12:32:37 +0100 Subject: [PATCH] Anonymous: Add 1min leeway in device count + search in tests for MySQL 5.7 (#101608) --- pkg/services/anonymous/anonimpl/impl_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/services/anonymous/anonimpl/impl_test.go b/pkg/services/anonymous/anonimpl/impl_test.go index 8a81c2035c9..f94190bc546 100644 --- a/pkg/services/anonymous/anonimpl/impl_test.go +++ b/pkg/services/anonymous/anonimpl/impl_test.go @@ -126,9 +126,9 @@ func TestIntegrationDeviceService_tag(t *testing.T) { { httpReq: &http.Request{ Header: http.Header{ - "User-Agent": []string{"test"}, - "X-Forwarded-For": []string{"10.30.30.1"}, - http.CanonicalHeaderKey(deviceIDHeader): []string{"32mdo31deeqwes"}, + "User-Agent": []string{"testdisabled"}, + "X-Forwarded-For": []string{"10.33.33.3"}, + http.CanonicalHeaderKey(deviceIDHeader): []string{"t35td154b13d1d"}, }, }, kind: anonymous.AnonDeviceUI, @@ -178,7 +178,8 @@ func TestIntegrationDeviceService_tag(t *testing.T) { assert.Equal(t, tc.expectedDevice, devices[0]) } - to := time.Now() + // One minute is added to the end time as mysql 5.7 datetime type has a default precision of seconds and not milis. + to := time.Now().Add(time.Minute) from := to.AddDate(0, 0, -1) devicesCount, err := anonService.CountDevices(ctx, from, to)