class StackTest(unittest.TestCase): def setUp(self): self.stack = Stack('main', '1.0.0', meta_path='/var/gachette') def tearDown(self): self.stack = None @mock.patch('gachette.lib.stack.run') def test_stack(self, stack_run_mock): name = 'app' version = '1.1.1' file_name = 'app-1.1.1.deb' self.stack.add_package(name, version, file_name) pkg_folder_dst = "/var/gachette/packages/%s/version/%s" % \ (name, version) stack_folder_dst = "/var/gachette/domain/main/stacks/%s/packages/%s" % \ (self.stack.version, name) stack_run_mock.assert_has_calls( [mock.call("mkdir -p %s" % pkg_folder_dst), mock.call("echo %s > %s/file" % (file_name, pkg_folder_dst)), mock.call("mkdir -p %s" % stack_folder_dst), mock.call("echo %s > %s/version" % (version, stack_folder_dst))])
class StackTest(unittest.TestCase): def setUp(self): self.stack = Stack('main', '1.0.0', meta_path='/var/gachette') def tearDown(self): self.stack = None @mock.patch('gachette.lib.stack.run') def test_stack(self, stack_run_mock): name = 'app' version = '1.1.1' file_name = 'app-1.1.1.deb' self.stack.add_package(name, version, file_name) pkg_folder_dst = "/var/gachette/packages/%s/version/%s" % \ (name, version) stack_folder_dst = "/var/gachette/domain/main/stacks/%s/packages/%s" % \ (self.stack.version, name) stack_run_mock.assert_has_calls([ mock.call("mkdir -p %s" % pkg_folder_dst), mock.call("echo %s > %s/file" % (file_name, pkg_folder_dst)), mock.call("mkdir -p %s" % stack_folder_dst), mock.call("echo %s > %s/version" % (version, stack_folder_dst)) ])
def add_package_to_stack_process(domain, stack, name, version, file_name): """ Add built package to the stack. """ with settings(host_string=host, key_filename=key_filename): s = Stack(domain, stack, meta_path="/var/gachette/", operator=StackOperatorRedis(redis_host=dd.REDIS_HOST)) s.add_package(name, version=version, file_name=file_name)
def init_add_package_to_stack_process(stack, name, version, file_name): """ Add built package to the stack. """ with settings(host_string=host, key_filename=key_filename): s = Stack(MAGIC_DOMAIN, stack, meta_path="/var/gachette/", operator=StackOperatorRedis(redis_host=dd.REDIS_HOST)) s.add_package(name, version=version, file_name=file_name) send_notification("stack #%s package %s (%s) added" % (stack, name, version))
def init_build_process(name, stack, project, url, branch, app_version, env_version, service_version, path_to_missile=None, webcallback=None): """ stack preparation """ args = ["name", "stack", "project", "url", "branch", "app_version", "env_version", "service_version", "path_to_missile", "webcallback"] for arg in args: print arg , ": ", locals()[arg] with settings(host_string=host, key_filename=key_filename): # TODO handle clone new_stack = Stack(MAGIC_DOMAIN, stack, meta_path="/var/gachette/", operator=StackOperatorRedis(redis_host=dd.REDIS_HOST)) print "DOM", new_stack.domain new_stack.persist() send_notification("stack #%s created" % stack) # call next step async checkout_build_process(name, url, branch, app_version, env_version, service_version, path_to_missile, webcallback)
def setUp(self): self.stack = Stack('main', '1.0.0', meta_path='/var/gachette')