-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3f3cfd
commit aeed3b7
Showing
7 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,25 @@ def test_emails | |
end | ||
end | ||
|
||
def test_emails_for_new_bad_data | ||
query = create_query | ||
check = create_check(query: query, check_type: "new_bad_data", emails: "[email protected],[email protected]") | ||
|
||
assert_emails 1 do | ||
Blazer.run_checks(schedule: "5 minutes") | ||
end | ||
|
||
assert_emails 0 do | ||
Blazer.run_checks(schedule: "5 minutes") | ||
end | ||
|
||
query.update!(statement: "SELECT 1 LIMIT 0") | ||
|
||
assert_emails 1 do | ||
Blazer.run_checks(schedule: "5 minutes") | ||
end | ||
end | ||
|
||
def test_slack | ||
query = create_query | ||
check = create_check(query: query, check_type: "bad_data", slack_channels: "#general,#random") | ||
|
@@ -83,6 +102,25 @@ def test_slack | |
end | ||
end | ||
|
||
def test_slack_for_new_bad_data | ||
query = create_query | ||
check = create_check(query: query, check_type: "new_bad_data", slack_channels: "#general,#random") | ||
|
||
assert_slack_messages 2 do | ||
Blazer.run_checks(schedule: "5 minutes") | ||
end | ||
|
||
assert_slack_messages 0 do | ||
Blazer.run_checks(schedule: "5 minutes") | ||
end | ||
|
||
query.update!(statement: "SELECT 1 LIMIT 0") | ||
|
||
assert_slack_messages 2 do | ||
Blazer.run_checks(schedule: "5 minutes") | ||
end | ||
end | ||
|
||
def assert_slack_messages(expected) | ||
count = 0 | ||
Blazer::SlackNotifier.stub :post_api, ->(*) { count += 1 } do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters