def test_gathered_defaults(self):
     env = self.get_base_env()
     del env['DOCKER_TAG']
     del env['SOURCE_BRANCH']
     del env['SOURCE_COMMIT']
     del env['SSH_PRIVATE']
     del env['BUILD_PATH']
     del env['DOCKERFILE_PATH']
     del env['BYON']
     del env['PUSH']
     del env['PUSH_ATTEMPT_COUNT']
     del env['LOG_BUILD_STEPS']
     b = runner.BuildRunner(env)
     assert b.docker_tag == 'latest'
     assert b.source_branch is None
     assert b.source_commit is None
     assert b.ssh_private is None
     assert b.build_path == '/'
     assert b.dockerfile_path == ''
     assert b.byon is None
     assert b.should_push is False
     assert b.push_attempt_count == 5
     assert b.log_build_steps is False
 def test_gathered(self):
     env = self.get_base_env()
     b = runner.BuildRunner(env)
     assert b.build_code == env['BUILD_CODE']
     assert b.docker_repo == env['DOCKER_REPO']
     assert b.docker_tags == [env['DOCKER_TAG']]
     assert b.docker_tag == env['DOCKER_TAG']
     assert b.source_type == env['SOURCE_TYPE']
     assert b.source_url == env['SOURCE_URL']
     assert b.source_branch == env['SOURCE_BRANCH']
     assert b.source_commit == env['SOURCE_COMMIT']
     assert b.ssh_private == env['SSH_PRIVATE']
     assert b.build_path == env['BUILD_PATH']
     assert b.dockerfile_path == env['DOCKERFILE_PATH']
     assert b.docker_host == env['DOCKER_HOST']
     assert b.dockercfg == env['DOCKERCFG']
     assert b.cache_tag == env['CACHE_TAG']
     assert b.signed_urls._mock_new_parent == self.mock_loads
     assert b.byon == env['BYON']
     assert b.should_push == bool(env['PUSH'] == 'TRUE')
     assert b.push_attempt_count == env['PUSH_ATTEMPT_COUNT']
     assert b.log_build_steps == bool(env['LOG_BUILD_STEPS'] == 'TRUE')
     assert b.max_log_size == env['MAX_LOG_SIZE']
Beispiel #3
0
def main():
    build_runner = runner.BuildRunner()
    install_handler(build_runner, interrupt)
    return build_runner.run()
 def test_custom_env(self):
     env = {'foo': 'bar'}
     runner.BuildRunner(env)
     self.mock_gather.assert_called_with(env)
 def test_init(self):
     b = runner.BuildRunner()
     self.mock_gather.assert_called_with(os.environ)
     assert b.client is None
     assert self.mock_image_name.called
     assert self.mock_cache_name.called