Skip to content

Commit ac966be

Browse files
author
Matthew Fisher
committed
feat(controller): add faulty cluster
This cluster type is intended for development purposes so that we can test a container's state when the scheduler fails to spawn a container.
1 parent 746e140 commit ac966be

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

controller/api/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class Cluster(UuidAuditedModel):
6363
"""
6464

6565
CLUSTER_TYPES = (('mock', 'Mock Cluster'),
66-
('coreos', 'CoreOS Cluster'))
66+
('coreos', 'CoreOS Cluster'),
67+
('faulty', 'Faulty Cluster'))
6768

6869
owner = models.ForeignKey(settings.AUTH_USER_MODEL)
6970
id = models.CharField(max_length=128, unique=True)

controller/scheduler/faulty.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
class FaultyClient(object):
2+
"""A faulty scheduler that will always fail"""
3+
4+
def __init__(self, cluster_name, hosts, auth, domain, options):
5+
pass
6+
7+
def setUp(self):
8+
pass
9+
10+
def tearDown(self):
11+
pass
12+
13+
def create(self, name, image, command='', template=None, port=5000):
14+
raise Exception()
15+
16+
def start(self, name):
17+
raise Exception()
18+
19+
def stop(self, name):
20+
raise Exception()
21+
22+
def destroy(self, name):
23+
raise Exception()
24+
25+
def run(self, name, image, command):
26+
raise Exception()
27+
28+
def attach(self, name):
29+
raise Exception()
30+
31+
SchedulerClient = FaultyClient

0 commit comments

Comments
 (0)