Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal test succeeds silently if no GITHUB_TOKEN is set #478

Open
andreasabel opened this issue Apr 19, 2022 · 1 comment
Open

cabal test succeeds silently if no GITHUB_TOKEN is set #478

andreasabel opened this issue Apr 19, 2022 · 1 comment
Labels
re: testsuite Concerning the testsuite

Comments

@andreasabel
Copy link
Member

andreasabel commented Apr 19, 2022

cabal test succeeds silently if no GITHUB_TOKEN is set.
However, in this case, most tests do not run. Maybe it is better that the test suite errors out if it cannot authenticate to github...

P.S.: Haskell-CI does not export GITHUB_TOKEN, so tests do not run on CI atm.

@andreasabel andreasabel added the re: testsuite Concerning the testsuite label Apr 19, 2022
@andreasabel
Copy link
Member Author

andreasabel commented Apr 19, 2022

Current failures are:

  1. myStarredR: Querying my starred repos will return something else depending on which user runs it.

    spec/GitHub/ActivitySpec.hs:40:25: 
    1) GitHub.Activity.myStarredR works
         predicate failed on: ...
    To rerun use: --match "/GitHub.Activity/myStarredR/works/"
    

    Maybe this should not be part of cabal test but rather be part of samples.

  2. Getting one's public SSH keys is also something user-specific...

spec/GitHub/PublicSSHKeysSpec.hs:18:23: 
2) GitHub.PublicSSHKeys, publicSSHKeys' and publicSSHKey', works
     uncaught exception: ErrorCall
     Expected a Right and got a LeftHTTPError (HttpExceptionRequest Request {
       host                 = "api.github.com"
       port                 = 443
       secure               = True
       requestHeaders       = [("User-Agent","github.hs/0.27.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
       path                 = "/user/keys"
       queryString          = ""
       method               = "GET"
       proxy                = Nothing
       rawBody              = False
       redirectCount        = 10
       responseTimeout      = ResponseTimeoutDefault
       requestVersion       = HTTP/1.1
       proxySecureMode      = ProxySecureWithConnect
     }
      (StatusCodeException (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Server","GitHub.com"),("Date","Tue, 19 Apr 2022 16:35:49 GMT"),("Content-Type","application/json; charset=utf-8"),("Transfer-Encoding","chunked"),("X-OAuth-Scopes","public_repo"),("X-Accepted-OAuth-Scopes","admin:public_key, read:public_key, write:public_key"),("X-GitHub-Media-Type","github.v3; format=json"),("X-RateLimit-Limit","5000"),("X-RateLimit-Remaining","4786"),("X-RateLimit-Reset","1650389589"),("X-RateLimit-Used","214"),("X-RateLimit-Resource","core"),("Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset"),("Access-Control-Allow-Origin","*"),("Strict-Transport-Security","max-age=31536000; includeSubdomains; preload"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("X-XSS-Protection","0"),("Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("Content-Security-Policy","default-src 'none'"),("Vary","Accept-Encoding, Accept, X-Requested-With"),("Content-Encoding","gzip"),("X-GitHub-Request-Id","EB71:F07D:1AD8CF:1CE2F3:625EE4E5")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose, responseOriginalRequest = Request {
       host                 = "api.github.com"
       port                 = 443
       secure               = True
       requestHeaders       = [("User-Agent","github.hs/0.27.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
       path                 = "/user/keys"
       queryString          = ""
       method               = "GET"
       proxy                = Nothing
       rawBody              = False
       redirectCount        = 10
       responseTimeout      = ResponseTimeoutDefault
       requestVersion       = HTTP/1.1
       proxySecureMode      = ProxySecureWithConnect
     }
     }) "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/reference/users#list-public-ssh-keys-for-the-authenticated-user\"}"))
     CallStack (from HasCallStack):
       error, called at spec/GitHub/PublicSSHKeysSpec.hs:18:23 in main:GitHub.PublicSSHKeysSpec

To rerun use: --match "/GitHub.PublicSSHKeys/publicSSHKeys' and publicSSHKey'/works/"
  spec/GitHub/SearchSpec.hs:25:23: 
  3) GitHub.Search.searchIssues performs an issue search via the API
       uncaught exception: ErrorCall
       Expected a Right and got a LeftHTTPError (HttpExceptionRequest Request {
         host                 = "api.github.com"
         port                 = 443
         secure               = True
         requestHeaders       = [("User-Agent","github.hs/0.27.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
         path                 = "/search/issues"
         queryString          = "?q=Decouple%20in%3Atitle%20repo%3Aphadej%2Fgithub%20created%3A%3C%3D2015-12-01"
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
         proxySecureMode      = ProxySecureWithConnect
       }
        (StatusCodeException (Response {responseStatus = Status {statusCode = 422, statusMessage = "Unprocessable Entity"}, responseVersion = HTTP/1.1, responseHeaders = [("Server","GitHub.com"),("Date","Tue, 19 Apr 2022 16:38:19 GMT"),("Content-Type","application/json; charset=utf-8"),("Content-Length","301"),("Cache-Control","no-cache"),("Vary","Accept, Authorization, Cookie, X-GitHub-OTP"),("X-OAuth-Scopes","public_repo"),("X-Accepted-OAuth-Scopes",""),("X-GitHub-Media-Type","github.v3; format=json"),("X-RateLimit-Limit","30"),("X-RateLimit-Remaining","29"),("X-RateLimit-Reset","1650386359"),("X-RateLimit-Used","1"),("X-RateLimit-Resource","search"),("Access-Control-Expose-Headers","ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset"),("Access-Control-Allow-Origin","*"),("Strict-Transport-Security","max-age=31536000; includeSubdomains; preload"),("X-Frame-Options","deny"),("X-Content-Type-Options","nosniff"),("X-XSS-Protection","0"),("Referrer-Policy","origin-when-cross-origin, strict-origin-when-cross-origin"),("Content-Security-Policy","default-src 'none'"),("Vary","Accept-Encoding, Accept, X-Requested-With"),("X-GitHub-Request-Id","EB8D:76B8:1772E1:1979D4:625EE57A")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose, responseOriginalRequest = Request {
         host                 = "api.github.com"
         port                 = 443
         secure               = True
         requestHeaders       = [("User-Agent","github.hs/0.27.1"),("Accept","application/vnd.github.v3+json"),("Authorization","<REDACTED>")]
         path                 = "/search/issues"
         queryString          = "?q=Decouple%20in%3Atitle%20repo%3Aphadej%2Fgithub%20created%3A%3C%3D2015-12-01"
         method               = "GET"
         proxy                = Nothing
         rawBody              = False
         redirectCount        = 10
         responseTimeout      = ResponseTimeoutDefault
         requestVersion       = HTTP/1.1
         proxySecureMode      = ProxySecureWithConnect
       }
       }) "{\"message\":\"Validation Failed\",\"errors\":[{\"message\":\"The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.\",\"resource\":\"Search\",\"field\":\"q\",\"code\":\"invalid\"}],\"documentation_url\":\"https://docs.github.com/v3/search/\"}"))
       CallStack (from HasCallStack):
         error, called at spec/GitHub/SearchSpec.hs:25:23 in main:GitHub.SearchSpec

  To rerun use: --match "/GitHub.Search/searchIssues/performs an issue search via the API/"

Randomized with seed 574216989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: testsuite Concerning the testsuite
Projects
None yet
Development

No branches or pull requests

1 participant