From dede58bf5de42899f9c2db944e9b6ca46ba2ffda Mon Sep 17 00:00:00 2001 From: Thibault Le Ouay Ducasse Date: Wed, 8 Jul 2026 22:06:14 +0200 Subject: [PATCH] private location: bug ingest server --- apps/private-location/internal/server/ingest_dns.go | 2 +- .../internal/server/ingest_dns_test.go | 12 ++++++++---- apps/private-location/internal/server/ingest_tcp.go | 2 +- .../internal/server/ingest_tcp_test.go | 9 ++++++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/apps/private-location/internal/server/ingest_dns.go b/apps/private-location/internal/server/ingest_dns.go index 053156102..818b2a70a 100644 --- a/apps/private-location/internal/server/ingest_dns.go +++ b/apps/private-location/internal/server/ingest_dns.go @@ -42,7 +42,7 @@ func (h *privateLocationHandler) IngestDNS(ctx context.Context, req *connect.Req return nil, NewValidationError(err) } - ic, err := h.getIngestContext(ctx, token, req.Msg.Id) + ic, err := h.getIngestContext(ctx, token, req.Msg.MonitorId) if err != nil { return nil, connect.NewError(connect.CodeInternal, err) } diff --git a/apps/private-location/internal/server/ingest_dns_test.go b/apps/private-location/internal/server/ingest_dns_test.go index 098e9646f..e1ff445c8 100644 --- a/apps/private-location/internal/server/ingest_dns_test.go +++ b/apps/private-location/internal/server/ingest_dns_test.go @@ -117,7 +117,8 @@ func TestIngestDNS_MonitorNotExist(t *testing.T) { h := server.NewPrivateLocationServer(testDB(), tinybird.NewClient(http.DefaultClient, "")) req := connect.NewRequest(&private_locationv1.IngestDNSRequest{ - Id: "nonexistent-monitor", + Id: "dns-123", + MonitorId: "nonexistent-monitor", Timestamp: 1234567890, }) req.Header().Set("openstatus-token", "my-secret-key") @@ -138,7 +139,8 @@ func TestIngestDNS_MonitorExist(t *testing.T) { h := server.NewPrivateLocationServer(testDB(), getTBClient(context.Background())) req := connect.NewRequest(&private_locationv1.IngestDNSRequest{ - Id: "5", + Id: "dns-result-1", + MonitorId: "5", Timestamp: 1234567890, Latency: 50, CronTimestamp: 1234567800, @@ -161,7 +163,8 @@ func TestIngestDNS_WithRecords(t *testing.T) { h := server.NewPrivateLocationServer(testDB(), getTBClient(context.Background())) req := connect.NewRequest(&private_locationv1.IngestDNSRequest{ - Id: "5", + Id: "dns-result-2", + MonitorId: "5", Timestamp: 1234567890, Latency: 50, CronTimestamp: 1234567800, @@ -191,7 +194,8 @@ func TestIngestDNS_WithError(t *testing.T) { h := server.NewPrivateLocationServer(testDB(), getTBClient(context.Background())) req := connect.NewRequest(&private_locationv1.IngestDNSRequest{ - Id: "5", + Id: "dns-result-3", + MonitorId: "5", Timestamp: 1234567890, Latency: 0, CronTimestamp: 1234567800, diff --git a/apps/private-location/internal/server/ingest_tcp.go b/apps/private-location/internal/server/ingest_tcp.go index 32e67f767..8545f92a5 100644 --- a/apps/private-location/internal/server/ingest_tcp.go +++ b/apps/private-location/internal/server/ingest_tcp.go @@ -38,7 +38,7 @@ func (h *privateLocationHandler) IngestTCP(ctx context.Context, req *connect.Req return nil, NewValidationError(err) } - ic, err := h.getIngestContext(ctx, token, req.Msg.Id) + ic, err := h.getIngestContext(ctx, token, req.Msg.MonitorId) if err != nil { return nil, connect.NewError(connect.CodeInternal, err) } diff --git a/apps/private-location/internal/server/ingest_tcp_test.go b/apps/private-location/internal/server/ingest_tcp_test.go index dc86f0b81..dccea2ec2 100644 --- a/apps/private-location/internal/server/ingest_tcp_test.go +++ b/apps/private-location/internal/server/ingest_tcp_test.go @@ -116,7 +116,8 @@ func TestIngestTCP_MonitorNotExist(t *testing.T) { h := server.NewPrivateLocationServer(testDB(), tinybird.NewClient(http.DefaultClient, "")) req := connect.NewRequest(&private_locationv1.IngestTCPRequest{ - Id: "nonexistent-monitor", + Id: "tcp-123", + MonitorId: "nonexistent-monitor", Timestamp: 1234567890, }) req.Header().Set("openstatus-token", "my-secret-key") @@ -137,7 +138,8 @@ func TestIngestTCP_MonitorExist(t *testing.T) { h := server.NewPrivateLocationServer(testDB(), getTBClient(context.Background())) req := connect.NewRequest(&private_locationv1.IngestTCPRequest{ - Id: "5", + Id: "tcp-result-1", + MonitorId: "5", Timestamp: 1234567890, Latency: 50, CronTimestamp: 1234567800, @@ -159,7 +161,8 @@ func TestIngestTCP_WithError(t *testing.T) { h := server.NewPrivateLocationServer(testDB(), getTBClient(context.Background())) req := connect.NewRequest(&private_locationv1.IngestTCPRequest{ - Id: "5", + Id: "tcp-result-2", + MonitorId: "5", Timestamp: 1234567890, Latency: 0, CronTimestamp: 1234567800, -- 2.51.2