fix flaky TestIntegrationsSandbox/TestInstallerHeadCheck (#7345)

this adjusts the TestInstallerHeadCheck check to use `DoRaw` instead of `Do`, which sends a body with null when nil is passed for the params parameter.
This commit is contained in:
Roberto Dip 2022-08-23 09:58:10 -03:00 committed by GitHub
parent 7e1e69c9bc
commit fe9cdb7017
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,21 +102,21 @@ func (s *integrationSandboxTestSuite) TestInstallerGet() {
func (s *integrationSandboxTestSuite) TestInstallerHeadCheck() {
validURL := installerURL(enrollSecret, "pkg", false)
s.Do("HEAD", validURL, nil, http.StatusOK)
s.DoRaw("HEAD", validURL, nil, http.StatusOK)
// unauthorized requests
s.DoRawNoAuth("HEAD", validURL, nil, http.StatusUnauthorized)
s.token = "invalid"
s.Do("HEAD", validURL, nil, http.StatusUnauthorized)
s.DoRaw("HEAD", validURL, nil, http.StatusUnauthorized)
s.token = s.cachedAdminToken
// wrong enroll secret
invalidURL := installerURL("wrong-enroll", "pkg", false)
s.Do("HEAD", invalidURL, nil, http.StatusInternalServerError)
s.DoRaw("HEAD", invalidURL, nil, http.StatusInternalServerError)
// non-existent package
invalidURL = installerURL(enrollSecret, "exe", false)
s.Do("HEAD", invalidURL, nil, http.StatusNotFound)
s.DoRaw("HEAD", invalidURL, nil, http.StatusNotFound)
}
func installerURL(secret, kind string, desktop bool) string {