(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func getRESTClient(t *testing.T) *gogithub.Client { |
| 65 | // Get token and ensure Docker image is built |
| 66 | token := getE2EToken(t) |
| 67 | |
| 68 | // Create a new GitHub client with the token |
| 69 | ghClient := gogithub.NewClient(nil).WithAuthToken(token) |
| 70 | |
| 71 | if host := getE2EHost(); host != "" && host != "https://github.com" { |
| 72 | var err error |
| 73 | // Currently this works for GHEC because the API is exposed at the api subdomain and the path prefix |
| 74 | // but it would be preferable to extract the host parsing from the main server logic, and use it here. |
| 75 | ghClient, err = ghClient.WithEnterpriseURLs(host, host) |
| 76 | require.NoError(t, err, "expected to create GitHub client with host") |
| 77 | } |
| 78 | |
| 79 | return ghClient |
| 80 | } |
| 81 | |
| 82 | // waitForRateLimit checks the current rate limit and waits if necessary. |
| 83 | // It ensures we have at least minRateLimitRemaining requests available before proceeding. |
no test coverage detected