Skip to content
This repository was archived by the owner on Dec 24, 2019. It is now read-only.

Commit 2bf59fd

Browse files
author
Nick Jüttner
committed
Add unit tests
1 parent 18e370b commit 2bf59fd

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

kube_aws_autoscaler/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def is_healthy():
346346

347347

348348
def start_health_endpoint():
349-
app.run(host='0.0.0.0', port=5000)
349+
app.run(port=5000)
350350

351351

352352
def autoscale(buffer_percentage: dict, buffer_fixed: dict, buffer_spare_nodes: int=0, include_master_nodes: bool=False, dry_run: bool=False):

tests/test_autoscaler.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from unittest.mock import MagicMock
3+
import unittest
34

45
import pytest
56

@@ -11,7 +12,7 @@
1112
is_sufficient, main, parse_resource,
1213
resize_auto_scaling_groups,
1314
scaling_activity_in_progress,
14-
slow_down_downscale)
15+
slow_down_downscale, app)
1516

1617

1718
def test_parse_resource():
@@ -408,3 +409,14 @@ def test_chunks():
408409
assert list(chunks([1], 1)) == [[1]]
409410
assert list(chunks([1, 2], 1)) == [[1], [2]]
410411
assert list(chunks([1, 2, 3], 2)) == [[1, 2], [3]]
412+
413+
414+
class FlaskTest(unittest.TestCase):
415+
def test_start_health_endpoint(self):
416+
self.app = app.test_client()
417+
self.app.testing = True
418+
response = self.app.get('/healthz')
419+
self.assertEqual(response.status_code, 500)
420+
421+
def tearDown(self):
422+
pass

0 commit comments

Comments
 (0)