MCPcopy Create free account
hub / github.com/apache/mesos / Master

Class Master

src/python/cli_new/lib/cli/tests/base.py:158–212  ·  view source on GitHub ↗

This class defines the functions necessary to launch a master in the CLI unit tests.

Source from the content-addressed store, hash-verified

156
157
158class Master(Executable):
159 """
160 This class defines the functions necessary to launch a master in
161 the CLI unit tests.
162 """
163 count = 0
164
165 def __init__(self, flags=None):
166 super(Master, self).__init__()
167
168 if Master.count > 0:
169 raise CLIException("Creating more than one master"
170 " is currently not possible")
171
172 if flags is None:
173 flags = {}
174
175 if "ip" not in flags:
176 flags["ip"] = TEST_MASTER_IP
177 if "port" not in flags:
178 flags["port"] = TEST_MASTER_PORT
179 if "work_dir" not in flags:
180 flags["work_dir"] = tempfile.mkdtemp()
181
182 self.flags = flags
183 self.name = "master"
184 self.addr = "{ip}:{port}".format(ip=flags["ip"], port=flags["port"])
185 self.executable = os.path.join(
186 CLITestCase.MESOS_BUILD_DIR,
187 "bin",
188 "mesos-{name}.sh".format(name=self.name))
189 self.shell = True
190
191 def __del__(self):
192 super(Master, self).__del__()
193
194 if hasattr(self, "flags") and hasattr(self.flags, "work_dir"):
195 shutil.rmtree(self.flags["work_dir"])
196
197 # pylint: disable=arguments-differ
198 def launch(self):
199 """
200 After starting the master, we need to make sure its
201 reference count is increased.
202 """
203 super(Master, self).launch()
204 Master.count += 1
205
206 def kill(self):
207 """
208 After killing the master, we need to make sure its
209 reference count is decreased.
210 """
211 super(Master, self).kill()
212 Master.count -= 1
213
214
215class Agent(Executable):

Callers 7

test_execMethod · 0.90
test_exec_exit_statusMethod · 0.90
test_exec_interactiveMethod · 0.90
test_listMethod · 0.90
test_list_allMethod · 0.90
test_launch_binariesMethod · 0.90
test_listMethod · 0.90

Calls

no outgoing calls

Tested by 7

test_execMethod · 0.72
test_exec_exit_statusMethod · 0.72
test_exec_interactiveMethod · 0.72
test_listMethod · 0.72
test_list_allMethod · 0.72
test_launch_binariesMethod · 0.72
test_listMethod · 0.72