@@ -19,6 +19,7 @@ import (
1919 "bytes"
2020 "context"
2121 "encoding/json"
22+ "encoding/pem"
2223 "fmt"
2324 "io"
2425 "net"
@@ -130,14 +131,24 @@ func TestCollectorGatewayEndToEnd(t *testing.T) {
130131
131132 receiverPort := availableTCPPort (t )
132133 healthPort := availableTCPPort (t )
134+
135+ // sakauth rejects insecure_skip_verify, so trust the test server's
136+ // certificate explicitly. This also makes the test exercise real
137+ // certificate verification rather than skipping it.
138+ caPath := filepath .Join (t .TempDir (), "backend-ca.pem" )
139+ require .NoError (t , os .WriteFile (caPath , pem .EncodeToMemory (& pem.Block {
140+ Type : "CERTIFICATE" ,
141+ Bytes : backend .Certificate ().Raw ,
142+ }), 0o600 ))
143+
133144 configPath := filepath .Join (t .TempDir (), "collector.yaml" )
134145 require .NoError (t , os .WriteFile (configPath , []byte (fmt .Sprintf (`
135146extensions:
136147 sakauth:
137148 enroll_endpoint: %[1]s/enroll
138149 sak_token: integration-sak
139150 tls:
140- insecure_skip_verify: true
151+ ca_file: %[4]s
141152 health_check:
142153 endpoint: 127.0.0.1:%[2]d
143154receivers:
@@ -155,7 +166,7 @@ exporters:
155166 logs_endpoint: %[1]s/logs
156167 compression: none
157168 tls:
158- insecure_skip_verify: true
169+ ca_file: %[4]s
159170 auth:
160171 authenticator: sakauth
161172service:
@@ -169,7 +180,7 @@ service:
169180 receivers: [otlp]
170181 processors: [batch]
171182 exporters: [otlp_http/backend]
172- ` , backend .URL , healthPort , receiverPort )), 0o600 ))
183+ ` , backend .URL , healthPort , receiverPort , caPath )), 0o600 ))
173184
174185 ctx , cancel := context .WithTimeout (context .Background (), 30 * time .Second )
175186 logPath := filepath .Join (t .TempDir (), "collector.log" )
0 commit comments