Skip to content

Commit

Permalink
feat(pingdom): review
Browse files Browse the repository at this point in the history
  • Loading branch information
rkettelerij committed Jun 20, 2024
1 parent fa16dc2 commit 63f85f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func main() {
}
alertIntegrationIDs, err := util.StringsToInts(pingdomAlertIntegrationIDs)
if err != nil {
setupLog.Error(err, "Unable to parse 'pingdom-alert-integration-ids' flag: %v")
setupLog.Error(err, "Unable to parse 'pingdom-alert-integration-ids' flag")
os.Exit(1)
}
uptimeProviderSettings = providers.PingdomSettings{
Expand Down
4 changes: 2 additions & 2 deletions internal/service/providers/pingdom.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func handleRateLimits(ctx context.Context, resp *http.Response) error {
if err != nil {
return err
}
if remainingShort < 10 {
if remainingShort < 25 {
log.FromContext(ctx).Info(
fmt.Sprintf("Waiting for %d seconds to avoid hitting Pingdom rate limit", resetTimeShort+1),
headerReqLimitShort, remainingShort)
Expand All @@ -283,7 +283,7 @@ func handleRateLimits(ctx context.Context, resp *http.Response) error {
if err != nil {
return err
}
if remainingLong < 10 {
if remainingLong < 25 {
log.FromContext(ctx).Info(
fmt.Sprintf("Waiting for %d seconds to avoid hitting Pingdom rate limit", resetTimeLong+1),
headerReqLimitLong, remainingLong)
Expand Down
12 changes: 12 additions & 0 deletions internal/service/providers/pingdom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ func TestAgainstREALPingdomAPI(t *testing.T) {
"uptime.pdok.nl/response-check-for-string-not-contains": "",
},
},
{
name: "Update check again (test for idempotency)",
annotations: map[string]string{
"uptime.pdok.nl/id": "3w2e9d804b2cd6bf18b8c0a6e1c04e46ac62b98c",
"uptime.pdok.nl/name": "UptimeOperatorPingdomTestCheck - Updated",
"uptime.pdok.nl/url": "https://service.pdok.nl/cbs/landuse/wfs/v1_0?request=GetCapabilities&service=WFS",
"uptime.pdok.nl/tags": "tag1",
"uptime.pdok.nl/request-headers": "key1:value1, key2:value2, key3:value3",
"uptime.pdok.nl/response-check-for-string-contains": "",
"uptime.pdok.nl/response-check-for-string-not-contains": "",
},
},
{
name: "Delete check",
annotations: map[string]string{
Expand Down

0 comments on commit 63f85f8

Please sign in to comment.