Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 5f84beb

Browse files
Denys Smirnovdennwc
authored andcommitted
discovery: ignore rate limit errors in tests
Signed-off-by: Denys Smirnov <denys@sourced.tech>
1 parent 87d7206 commit 5f84beb

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

driver/manifest/discovery/discovery.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ type Options struct {
196196
NoMaintainers bool // do not load maintainers list
197197
}
198198

199+
// isRateLimit checks if error is due to rate limiting.
200+
func isRateLimit(err error) bool {
201+
_, ok := err.(*github.RateLimitError)
202+
return ok
203+
}
204+
199205
// getDriversForOrg lists all repositories for an organization and filters ones that contains topics of the driver.
200206
func getDriversForOrg(ctx context.Context, org string) ([]Driver, error) {
201207
cli := github.NewClient(nil)

driver/manifest/discovery/discovery_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ func TestOfficialDrivers(t *testing.T) {
2525
t.SkipNow()
2626
}
2727
drivers, err := OfficialDrivers(context.Background(), nil)
28+
if isRateLimit(err) {
29+
t.Skip(err)
30+
}
2831
require.NoError(t, err)
2932
require.True(t, len(drivers) >= 15, "drivers: %d", len(drivers))
3033

0 commit comments

Comments
 (0)