Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if head of the [0- debounce] checks is all faild, debounce args lose efficacy #585

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions cabot/cabotapp/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def default_calculate_debounced_passing(recent_results, debounce=0):
"""
if not recent_results:
return True
# fix when the first run, if the first 0 - debounce checks all error and mark result faild
if len(recent_results) < debounce:
return True
debounce_window = recent_results[:debounce + 1]
for r in debounce_window:
if r.succeeded:
Expand Down
1 change: 1 addition & 0 deletions cabot/cabotapp/models/jenkins_check_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def calculate_debounced_passing(self, recent_results, debounce=0):
return last_result.consecutive_failures <= debounce



class JenkinsConfig(models.Model):
name = models.CharField(max_length=30, blank=False)
jenkins_api = models.CharField(max_length=2000, blank=False)
Expand Down
1 change: 1 addition & 0 deletions cabot/cabotapp/tests/tests_jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def test_job_failing(self, mock_jenkins):
self.assertEqual(result.consecutive_failures, 1)
self.assertFalse(result.succeeded)


@freeze_time('2017-03-02 10:30')
@patch("cabot.cabotapp.jenkins._get_jenkins_client")
def test_job_queued_last_succeeded(self, mock_jenkins):
Expand Down
2 changes: 1 addition & 1 deletion cabot/cabotapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ def get(self, request):

return Response(users_json)


# Misc JSON api and other stuff


Expand Down