From 945eb778a66b85d68066b7c912978be4aef60e2d Mon Sep 17 00:00:00 2001 From: Jahziel Villasana-Espinoza Date: Tue, 4 Jun 2024 09:45:53 -0400 Subject: [PATCH] fix: ensure test cleanup --- server/service/integration_mdm_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/service/integration_mdm_test.go b/server/service/integration_mdm_test.go index 294e0f37cf..aeca01bc33 100644 --- a/server/service/integration_mdm_test.go +++ b/server/service/integration_mdm_test.go @@ -931,6 +931,7 @@ func (s *integrationMDMTestSuite) TestGetMDMCSR() { // Validate errors if no private key is set testSetEmptyPrivateKey = true + t.Cleanup(func() { testSetEmptyPrivateKey = false }) s.uploadAPNSCert([]byte("-----BEGIN CERTIFICATE-----\nZm9vCg==\n-----END CERTIFICATE-----"), http.StatusInternalServerError, "Couldn't upload APNs certificate. Missing required private key. Learn how to configure the private key here: https://fleetdm.com/learn-more-about/fleet-server-private-key") r := s.Do("GET", "/api/latest/fleet/mdm/apple/request_csr", getMDMAppleCSRRequest{}, http.StatusInternalServerError) @@ -8677,6 +8678,7 @@ func (s *integrationMDMTestSuite) TestABMAssetManagement() { // Validate error when server private key not set testSetEmptyPrivateKey = true + t.Cleanup(func() { testSetEmptyPrivateKey = false }) r := s.Do("GET", "/api/latest/fleet/mdm/apple/abm_public_key", generateABMKeyPairResponse{}, http.StatusInternalServerError) require.Contains(t, extractServerErrorText(r.Body), "Couldn't download public key. Missing required private key. Learn how to configure the private key here: https://fleetdm.com/learn-more-about/fleet-server-private-key")