Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

sensu_go_check - idempotent cron checks #129

Merged
merged 5 commits into from
Jun 19, 2019

Conversation

jaredledvina
Copy link
Owner

To help with #124, this adds a test that should fail if there's a bug w/ the idempotent nature of cron style checks.

Opening for TravisCI to run, I expect that this will fail and will work to resolve that on this branch as well.

Signed-off-by: Jared Ledvina jared@techsmix.net

@jaredledvina jaredledvina self-assigned this Jun 19, 2019
@jaredledvina jaredledvina force-pushed the feature/ensure-cron-checks-are-idempotent branch from f48c97f to 81f17e9 Compare June 19, 2019 12:29
Signed-off-by: Jared Ledvina <jared@techsmix.net>
@jaredledvina jaredledvina force-pushed the feature/ensure-cron-checks-are-idempotent branch from 81f17e9 to f1ad235 Compare June 19, 2019 12:37
@jaredledvina
Copy link
Owner Author

Alright, so there is a bug, this failure https://travis-ci.com/jaredledvina/sensu-go-ansible/jobs/209275428#L1132 confirms that.

I think this is because the Sensu Go API is returning 0 instead of null for interval when a check is cron check is configured.

Signed-off-by: Jared Ledvina <jared@techsmix.net>
@jaredledvina
Copy link
Owner Author

Yep....

Existing check w/ interval:

❯ sensuctl check info check_test
=== check_test
Name:              check_test
Interval:          30
Command:           /bin/true
Cron:
Timeout:           0
TTL:               0
Subscriptions:     all
Handlers:
Runtime Assets:
Hooks:
Publish?:          true
Stdin?:            false
Proxy Entity Name:
Namespace:         default
Metric Format:
Metric Handlers:

Configure it as a cron based check:

❯ sensuctl check set-cron check_test '* * * * *'
Updated

Interval is now reset to 0 versus being nil:

❯ sensuctl check info check_test
=== check_test
Name:              check_test
Interval:          0
Command:           /bin/true
Cron:              * * * * *
Timeout:           0
TTL:               0
Subscriptions:     all
Handlers:
Runtime Assets:
Hooks:
Publish?:          true
Stdin?:            false
Proxy Entity Name:
Namespace:         default
Metric Format:
Metric Handlers:

Latest change should work and make the tests pass.

@jaredledvina jaredledvina changed the title sensu_go_check - idempotent test for cron check sensu_go_check - idempotent cron checks Jun 19, 2019
Signed-off-by: Jared Ledvina <jared@techsmix.net>
Signed-off-by: Jared Ledvina <jared@techsmix.net>
Signed-off-by: Jared Ledvina <jared@techsmix.net>
@jaredledvina jaredledvina merged commit 74ea673 into master Jun 19, 2019
@jaredledvina jaredledvina deleted the feature/ensure-cron-checks-are-idempotent branch June 19, 2019 21:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant