Skip to content

Commit a5666f1

Browse files
author
Matthew Fisher
authored
tests(scheduler): confirm "network unreachable" raises KubeHTTPException (#1142)
This error occurs when the registry hosting the image being pulled by `deis pull` (or, in the case of `git push deis master`, quay.io/deis/slugrunner) becomes unreachable. This test confirms that master has fixed the original error, which is that a KubeException used to be raised, being uncaught in older releases of Workflow. This has since been fixed in master.
1 parent 8133ab9 commit a5666f1

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

rootfs/scheduler/mock.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,11 @@ def put(request, context):
735735
context.status_code = 404
736736
context.reason = 'Not Found'
737737
return {}
738+
# raise a 503 when we want to intentionally test for it
739+
elif item['metadata']['name'] == 'image-pull-failed-test':
740+
context.status_code = 503
741+
context.reason = 'Network Unreachable'
742+
return {}
738743

739744
data = request.json()
740745

rootfs/scheduler/tests/test_deployments.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ def test_update_deployment_failure(self):
8888
msg='failed to update Deployment foo in Namespace {}: 404 Not Found'.format(self.namespace) # noqa
8989
):
9090
self.update(self.namespace, 'foo')
91+
name = 'image-pull-failed-test'
92+
self.create(name=name)
93+
with self.assertRaises(
94+
KubeHTTPException,
95+
msg='failed to update Deployment "{}": 503 Network Unreachable'.format(name)
96+
):
97+
self.update(self.namespace, name)
9198

9299
def test_update(self):
93100
# test success

0 commit comments

Comments
 (0)