-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathmock.py
More file actions
56 lines (44 loc) · 1.2 KB
/
mock.py
File metadata and controls
56 lines (44 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import json
from cStringIO import StringIO
class MockSchedulerClient(object):
def __init__(self, target, auth, options, pkey):
self.target = target
self.auth = auth
self.options = options
self.pkey = pkey
# container api
def create(self, name, image, command, **kwargs):
"""
Create a new container
"""
return
def start(self, name):
"""
Start a container
"""
return
def stop(self, name):
"""
Stop a container
"""
return
def destroy(self, name):
"""
Destroy a container
"""
return
def run(self, name, image, entrypoint, command):
"""
Run a one-off command
"""
# dump input into a json object for testing purposes
return 0, json.dumps({'name': name,
'image': image,
'entrypoint': entrypoint,
'command': command})
def attach(self, name):
"""
Attach to a job's stdin, stdout and stderr
"""
return StringIO(), StringIO(), StringIO()
SchedulerClient = MockSchedulerClient