Example #1
0
 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', )
             ],
         ))
Example #3
0
 def test_default(self):
     self.run_test(
         TestCaseParameters(
             args=['prepare', 'golang'],
             expected_calls=[PlaybookRunCallSpecification(
                 playbook_relative_path='prepare/golang',
             )],
         )
     )
Example #4
0
 def test_bootstrap_host(self):
     self.run_test(
         TestCaseParameters(
             args=['bootstrap', 'host'],
             expected_calls=[
                 PlaybookRunCallSpecification(
                     playbook_relative_path='bootstrap/host', )
             ],
         ))
Example #5
0
 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), },
                 )
             ],
         )
     )
Example #6
0
 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', },
                 )
             ],
         )
     )
Example #7
0
 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'], },
                 )
             ],
         )
     )
Example #8
0
 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'
                     })
             ],
         ))
Example #9
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'
                     })
             ],
         ))
Example #10
0
 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), },
                 )
             ],
         )
     )
Example #11
0
 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, },
                 )
             ],
         )
     )
Example #12
0
 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, },
                 )
             ],
         )
     )
Example #13
0
 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,
                     },
                 )
             ],
         ))
Example #14
0
 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,
                     },
                 )
             ],
         ))
Example #15
0
 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,
                     },
                 )
             ],
         ))
Example #16
0
 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'],
                     },
                 )
             ],
         ))
Example #17
0
 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',
                     },
                 )
             ],
         )
     )
Example #18
0
 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'
                         }
                     },
                 )
             ],
         ))
Example #19
0
 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',
                     },
                 )
             ],
         ))
Example #20
0
 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,
                     },
                 )
             ],
         )
     )
Example #21
0
 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,
                     },
                 )
             ],
         ))
Example #22
0
 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',
                     })
             ],
         ))
Example #23
0
 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',
                     })
             ],
         ))
Example #24
0
 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',
                         },
                     },
                 )
             ],
         ))
Example #25
0
 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',
                     },
                 )
             ],
         ))
Example #26
0
 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'
                     })
             ],
         ))
Example #27
0
 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],
                     },
                 )
             ],
         )
     )
Example #28
0
 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'
                     })
             ],
         ))
Example #29
0
 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',
                     })
             ],
         ))