def test_custom(self): os = OperatingSystem.centos stage = Stage.bare provider = Provider.vmware self.run_test( TestCaseParameters( args=[ 'provision', 'local', 'all-in-one', '--os', os, '--stage', stage, '--provider', provider ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='provision/vagrant-up', playbook_variables={ 'origin_ci_vagrant_os': os, 'origin_ci_vagrant_provider': provider, 'origin_ci_vagrant_stage': stage, }, ), PlaybookRunCallSpecification( playbook_relative_path= 'provision/vagrant-docker-storage', playbook_variables={ 'origin_ci_vagrant_provider': provider, }, ) ], ))
def test_prepare_repositories(self): self.run_test( TestCaseParameters( args=['prepare', 'repositories'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/repositories', ) ], ))
def test_default(self): self.run_test( TestCaseParameters( args=['prepare', 'golang'], expected_calls=[PlaybookRunCallSpecification( playbook_relative_path='prepare/golang', )], ) )
def test_bootstrap_host(self): self.run_test( TestCaseParameters( args=['bootstrap', 'host'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='bootstrap/host', ) ], ))
def test_preset(self): self.run_test( TestCaseParameters( args=['prepare', 'docker', '--for', Preset.origin_master], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/docker', playbook_variables={'origin_ci_docker_version': docker_version_for_preset(Preset.origin_master), }, ) ], ) )
def test_version(self): self.run_test( TestCaseParameters( args=['prepare', 'docker', '--version', '1.10.3'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/docker', playbook_variables={'origin_ci_docker_version': '1.10.3', }, ) ], ) )
def test_repourl(self): self.run_test( TestCaseParameters( args=['prepare', 'docker', '--repourl', 'https://www.myrepo.com/whatever'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/docker', playbook_variables={'origin_ci_docker_tmp_repourls': ['https://www.myrepo.com/whatever'], }, ) ], ) )
def test_tag(self): self.run_test( TestCaseParameters( args=['sync', 'remote', Repository.origin, '--tag', 'v1.0.0'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='sync/remote', playbook_variables={ 'origin_ci_sync_repository': Repository.origin, 'origin_ci_sync_version': 'v1.0.0' }) ], ))
def test_commit(self): self.run_test( TestCaseParameters( args=['sync', 'local', Repository.origin, '--commit', 'SHA'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='sync/local', playbook_variables={ 'origin_ci_sync_repository': Repository.origin, 'origin_ci_sync_version': 'SHA' }) ], ))
def test_preset(self): preset = Preset.origin_master self.run_test( TestCaseParameters( args=['prepare', 'golang', '--for', preset], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/golang', playbook_variables={'origin_ci_golang_version': golang_version_for_preset(preset), }, ) ], ) )
def test_version(self): version = '1.6.3' self.run_test( TestCaseParameters( args=['prepare', 'golang', '--version', version], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/golang', playbook_variables={'origin_ci_golang_version': version, }, ) ], ) )
def test_tmp_repourls(self): repourls = ['https://www.myrepo.com/whatever', 'https://www.myrepo.com/ok'] self.run_test( TestCaseParameters( args=['prepare', 'golang', '--repourl', repourls[0], '--repourl', repourls[1]], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/golang', playbook_variables={'origin_ci_golang_tmp_repourls': repourls, }, ) ], ) )
def test_os(self): os = OperatingSystem.centos self.run_test( TestCaseParameters( args=['provision', 'local', 'all-in-one', '--os', os], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='provision/vagrant-up', playbook_variables={ 'origin_ci_vagrant_os': os, }, ) ], ))
def test_ip(self): ip = '127.0.0.1' self.run_test( TestCaseParameters( args=['provision', 'local', 'all-in-one', '--master-ip', ip], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='provision/vagrant-up', playbook_variables={ 'origin_ci_vagrant_ip': ip, }, ) ], ))
def test_stage(self): stage = Stage.base self.run_test( TestCaseParameters( args=['provision', 'local', 'all-in-one', '--stage', stage], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='provision/vagrant-up', playbook_variables={ 'origin_ci_vagrant_stage': stage, }, ) ], ))
def test_basic(self): self.run_test( TestCaseParameters( args=['make', Repository.origin, 'target'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='make/main', playbook_variables={ 'origin_ci_make_repository': Repository.origin, 'origin_ci_make_targets': ['target'], }, ) ], ))
def test_repos(self): self.run_test( TestCaseParameters( args=['prepare', 'docker', '--repo', 'reponame', '--repo', 'otherrepo'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/docker', playbook_variables={ 'origin_ci_docker_disabledrepos': '*', 'origin_ci_docker_enabledrepos': 'reponame,otherrepo', }, ) ], ) )
def test_tag_single(self): self.run_test( TestCaseParameters( args=['package', 'ami', '--tag', 'env=prod', "--stage=next"], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='package/ami', playbook_variables={ 'origin_ci_aws_additional_tags': { 'env': 'prod' } }, ) ], ))
def test_default(self): self.run_test( TestCaseParameters( args=['provision', 'local', 'all-in-one'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='provision/vagrant-up', playbook_variables={ 'origin_ci_vagrant_os': OperatingSystem.fedora, 'origin_ci_vagrant_provider': Provider.libvirt, 'origin_ci_vagrant_stage': Stage.install, 'origin_ci_ssh_config_strategy': 'update', }, ) ], ))
def test_repos(self): repos = ['reponame', 'otherrepo'] self.run_test( TestCaseParameters( args=['prepare', 'golang', '--repo', repos[0], '--repo', repos[1]], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/golang', playbook_variables={ 'origin_ci_golang_disabledrepos': ['*'], 'origin_ci_golang_enabledrepos': repos, }, ) ], ) )
def test_provider(self): provider = Provider.virtualbox self.run_test( TestCaseParameters( args=[ 'provision', 'local', 'all-in-one', '--provider', provider ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='provision/vagrant-up', playbook_variables={ 'origin_ci_vagrant_provider': provider, }, ) ], ))
def test_remote(self): self.run_test( TestCaseParameters( args=[ 'sync', 'remote', Repository.origin, '--remote', 'myupstream' ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='sync/remote', playbook_variables={ 'origin_ci_sync_repository': Repository.origin, 'origin_ci_sync_remote': 'myupstream', }) ], ))
def test_explicit_destination(self): self.run_test( TestCaseParameters( args=[ 'sync', 'remote', Repository.origin, '--dest', '/some/remote/path' ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='sync/remote', playbook_variables={ 'origin_ci_sync_repository': Repository.origin, 'origin_ci_sync_destination': '/some/remote/path', }) ], ))
def test_one_envar(self): self.run_test( TestCaseParameters( args=['make', Repository.origin, 'target', '--env', 'KEY=VAL'], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='make/main', playbook_variables={ 'origin_ci_make_repository': Repository.origin, 'origin_ci_make_targets': ['target'], 'origin_ci_make_parameters': { 'KEY': 'VAL', }, }, ) ], ))
def test_explicit_destination(self): self.run_test( TestCaseParameters( args=[ 'make', Repository.origin, 'target', '--dest', '/some/path' ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='make/main', playbook_variables={ 'origin_ci_make_repository': Repository.origin, 'origin_ci_make_targets': ['target'], 'origin_ci_make_destination': '/some/path', }, ) ], ))
def test_refspec_branch(self): self.run_test( TestCaseParameters( args=[ 'sync', 'remote', Repository.origin, '--refspec', '/pulls/1/head', '--branch', 'myfeature' ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='sync/remote', playbook_variables={ 'origin_ci_sync_repository': Repository.origin, 'origin_ci_sync_version': 'myfeature', 'origin_ci_sync_refspec': '/pulls/1/head:myfeature' }) ], ))
def test_repo_and_repourl(self): repo = 'reponame' repourl = 'https://www.myrepo.com/whatever' self.run_test( TestCaseParameters( args=['prepare', 'golang', '--repo', repo, '--repourl', repourl], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='prepare/golang', playbook_variables={ 'origin_ci_golang_disabledrepos': ['*'], 'origin_ci_golang_enabledrepos': [repo], 'origin_ci_golang_tmp_repourls': [repourl], }, ) ], ) )
def test_explicit_source(self): # we need to use a real path on the host since Click validates the local path self.run_test( TestCaseParameters( args=[ 'sync', 'local', Repository.origin, '--src', abspath(dirname(__file__)) ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='sync/local', playbook_variables={ 'origin_ci_sync_repository': Repository.origin, 'origin_ci_sync_source': abspath(dirname(__file__)), 'origin_ci_sync_version': 'master' }) ], ))
def test_new_remote(self): self.run_test( TestCaseParameters( args=[ 'sync', 'remote', Repository.origin, '--new-remote', 'myupstream', 'https://mygitserver.com/origin.git' ], expected_calls=[ PlaybookRunCallSpecification( playbook_relative_path='sync/remote', playbook_variables={ 'origin_ci_sync_repository': Repository.origin, 'origin_ci_sync_remote': 'myupstream', 'origin_ci_sync_address': 'https://mygitserver.com/origin.git', }) ], ))