fixing integration test route for android certs (#36679)

Fixing test failure due to route change:

https://github.com/fleetdm/fleet/actions/runs/19917302253/job/57098874551

```
level=debug user=admin1@example.com method=GET uri=/api/latest/fleet/certificates took=4.878111ms
    http.go:49: Error trying to decode response body as Fleet jsonError: json: cannot unmarshal number into Go value of type endpoint_utils.JsonError
    http.go:50: 
        	Error Trace:	/home/runner/work/fleet/fleet/server/test/httptest/http.go:50
        	            				/home/runner/work/fleet/fleet/server/service/testing_client.go:275
        	            				/home/runner/work/fleet/fleet/server/service/testing_client.go:283
        	            				/home/runner/work/fleet/fleet/server/service/testing_client.go:259
        	            				/home/runner/work/fleet/fleet/server/service/testing_client.go:293
        	            				/home/runner/work/fleet/fleet/server/service/integration_core_test.go:8146
        	            				/opt/hostedtoolcache/go/1.25.3/x64/src/reflect/value.go:581
        	            				/opt/hostedtoolcache/go/1.25.3/x64/src/reflect/value.go:365
        	            				/home/runner/go/pkg/mod/github.com/stretchr/testify@v1.11.1/suite/suite.go:196
        	Error:      	Not equal: 
        	            	expected: 200
        	            	actual  : 404
        	Test:       	TestIntegrations/TestCertificatesSpecs
        	Messages:   	response: &{Status:404 Not Found StatusCode:404 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Content-Length:[19] Content-Type:[text/plain; charset=utf-8] Date:[Thu, 04 Dec 2025 04:11:18 GMT] X-Content-Type-Options:[nosniff]] Body:0xc00172e980 ContentLength:19 TransferEncoding:[] Close:false Uncompressed:false Trailer:map[] Request:0xc0007a1180 TLS:<nil>}
```
This commit is contained in:
Konstantin Sykulev 2025-12-04 11:02:16 -06:00 committed by GitHub
parent ccd66921e7
commit a44ea1fb12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8127,6 +8127,10 @@ func (s *integrationTestSuite) TestCertificatesSpecs() {
})
require.NoError(t, err)
noTeamOrbitNodeKey := uuid.New().String()
noTeamHost.OrbitNodeKey = &noTeamOrbitNodeKey
require.NoError(t, s.ds.UpdateHost(ctx, noTeamHost))
// Add an IDP user for host
err = s.ds.ReplaceHostDeviceMapping(ctx, noTeamHost.ID, []*fleet.HostDeviceMapping{
{
@ -8142,8 +8146,13 @@ func (s *integrationTestSuite) TestCertificatesSpecs() {
require.Len(t, savedNoTeamCertTemplates, 2)
noTeamCertID := savedNoTeamCertTemplates[0].ID
// Get certificate with orbit node_key (should return replaced variables)
var getNoTeamCertResp getDeviceCertificateTemplateResponse
s.DoJSON("GET", fmt.Sprintf("/api/v1/fleetd/certificates/%d?node_key=%s", noTeamCertID, *noTeamHost.NodeKey), nil, http.StatusOK, &getNoTeamCertResp)
resp = s.DoRawWithHeaders("GET", fmt.Sprintf("/api/fleetd/certificates/%d", noTeamCertID), nil, http.StatusOK, map[string]string{
"Authorization": fmt.Sprintf("Node key %s", noTeamOrbitNodeKey),
})
require.NoError(t, json.NewDecoder(resp.Body).Decode(&getNoTeamCertResp))
require.NoError(t, resp.Body.Close())
require.NotNil(t, getNoTeamCertResp.Certificate)
assert.Contains(t, getNoTeamCertResp.Certificate.SubjectName, "no.team.user@example.com")
assert.Contains(t, getNoTeamCertResp.Certificate.SubjectName, "test-no-team-uuid-12345")