当前位置: 首页>>代码示例>>Python>>正文


Python kubernetes_e2e.parse_args函数代码示例

本文整理汇总了Python中kubernetes_e2e.parse_args函数的典型用法代码示例。如果您正苦于以下问题:Python parse_args函数的具体用法?Python parse_args怎么用?Python parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了parse_args函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_kubeadm_pull

    def test_kubeadm_pull(self):
        """Make sure kubeadm pull mode is fine overall."""
        args = kubernetes_e2e.parse_args([
            '--mode=local',
            '--kubeadm=pull',
            '--use-shared-build=bazel'
        ])
        self.assertEqual(args.mode, 'local')
        self.assertEqual(args.kubeadm, 'pull')
        self.assertEqual(args.use_shared_build, 'bazel')

        gcs_bucket = "gs://kubernetes-release-dev/bazel/v1.8.0-beta.1.132+599539dc0b9997"

        def fake_gcs_path(path):
            bazel_default = os.path.join(
                'gs://kubernetes-jenkins/shared-results', 'bazel-build-location.txt')
            self.assertEqual(path, bazel_default)
            return gcs_bucket
        with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
            with Stub(kubernetes_e2e, 'read_gcs_path', fake_gcs_path):
                kubernetes_e2e.main(args)

        self.assertNotIn('E2E_OPT', self.envs)
        version = '%s/bin/linux/amd64/' % gcs_bucket
        self.assertIn('--kubernetes-anywhere-kubeadm-version=%s' % version, self.callstack[-1])
开发者ID:ihmccreery,项目名称:test-infra,代码行数:25,代码来源:kubernetes_e2e_test.py


示例2: test_check_leaks_false_docker

 def test_check_leaks_false_docker(self):
     """Ensure we also set FAIL_ON_GCP_RESOURCE_LEAK when mode=docker."""
     args = kubernetes_e2e.parse_args(['--mode=docker', '--check-leaked-resources=false'])
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         kubernetes_e2e.main(args)
         self.assertIn('--check-leaked-resources=false', self.callstack[-1])
         self.assertIn('-e FAIL_ON_GCP_RESOURCE_LEAK=false', self.callstack[-1])
开发者ID:droot,项目名称:test-infra,代码行数:7,代码来源:kubernetes_e2e_test.py


示例3: test_check_leaks_unset

 def test_check_leaks_unset(self):
     """Ensure --check-leaked-resources=true sends flag to kubetest."""
     args = kubernetes_e2e.parse_args(['--mode=local'])
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         kubernetes_e2e.main(args)
         self.assertNotIn('--check-leaked-resources', self.callstack[-1])
         self.assertEquals('false', self.envs.get('FAIL_ON_GCP_RESOURCE_LEAK'))
开发者ID:droot,项目名称:test-infra,代码行数:7,代码来源:kubernetes_e2e_test.py


示例4: test_aws

    def test_aws(self):
        temp = tempfile.NamedTemporaryFile()
        args = kubernetes_e2e.parse_args([
            '--aws',
            '--cluster=foo',
            '--aws-cluster-domain=test-aws.k8s.io',
            '--aws-ssh=%s' % temp.name,
            '--aws-pub=%s' % temp.name,
            '--aws-cred=%s' % temp.name,
            ])
        with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
            kubernetes_e2e.main(args)

        lastcall = self.callstack[-1]
        self.assertIn('kops-e2e-runner.sh', lastcall)
        self.assertIn('--kops-cluster=foo.test-aws.k8s.io', lastcall)
        self.assertIn('--kops-zones', lastcall)
        self.assertIn('--kops-state=s3://k8s-kops-jenkins/', lastcall)
        self.assertIn('--kops-nodes=4', lastcall)
        self.assertIn('--kops-ssh-key', lastcall)

        self.assertEqual(
            self.envs['JENKINS_AWS_SSH_PRIVATE_KEY_FILE'], temp.name)
        self.assertEqual(
            self.envs['JENKINS_AWS_SSH_PUBLIC_KEY_FILE'], temp.name)
        self.assertEqual(
            self.envs['JENKINS_AWS_CREDENTIALS_FILE'], temp.name)
开发者ID:ihmccreery,项目名称:test-infra,代码行数:27,代码来源:kubernetes_e2e_test.py


示例5: test_migrated_kubetest_args

 def test_migrated_kubetest_args(self):
     migrated = [
         '--stage=a-stage',
         '--stage-suffix=panda',
         '--random-flag', 'random-value',
         '--multiple-federations',
         'arg1', 'arg2',
         '--federation',
         '--kubemark',
         '--extract=this',
         '--extract=that',
         '--perf-tests',
         '--deployment=yay',
         '--save=somewhere',
         '--skew',
         '--publish=location',
         '--timeout=42m',
         '--upgrade_args=ginkgo',
         '--check-leaked-resources=true',
         '--charts',
     ]
     args = kubernetes_e2e.parse_args(['--mode=docker'] + migrated + ['--test=false'])
     self.assertEquals(migrated, args.kubetest_args)
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         kubernetes_e2e.main(args)
     lastcall = self.callstack[-2]
     for arg in migrated:
         self.assertIn(arg, lastcall)
开发者ID:mikedanese,项目名称:test-infra,代码行数:28,代码来源:kubernetes_e2e_test.py


示例6: test_updown_set

 def test_updown_set(self):
     args = kubernetes_e2e.parse_args(['--mode=local', '--up=false', '--down=true'])
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         kubernetes_e2e.main(args)
     lastcall = self.callstack[-1]
     self.assertNotIn('--up', lastcall)
     self.assertIn('--down', lastcall)
开发者ID:mikedanese,项目名称:test-infra,代码行数:7,代码来源:kubernetes_e2e_test.py


示例7: test_updown_default

 def test_updown_default(self):
     args = kubernetes_e2e.parse_args([])
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         kubernetes_e2e.main(args)
     lastcall = self.callstack[-1]
     self.assertIn('--up', lastcall)
     self.assertIn('--down', lastcall)
开发者ID:Kashomon,项目名称:test-infra,代码行数:7,代码来源:kubernetes_e2e_test.py


示例8: test_parse_args_order_agnostic

 def test_parse_args_order_agnostic(self):
     args = kubernetes_e2e.parse_args([
         '--mode=local',
         '--some-kubetest-arg=foo',
         '--cluster=test'])
     self.assertEqual(args.kubetest_args, ['--some-kubetest-arg=foo'])
     self.assertEqual(args.mode, 'local')
     self.assertEqual(args.cluster, 'test')
开发者ID:ihmccreery,项目名称:test-infra,代码行数:8,代码来源:kubernetes_e2e_test.py


示例9: test_env_docker

 def test_env_docker(self):
     env = 'FOO=bar blatz'
     args = kubernetes_e2e.parse_args([
         '--mode=docker',
         '--env=' + env,
     ])
     kubernetes_e2e.main(args)
     self.assertIn('-e '+env, self.callstack[-2])
开发者ID:ihmccreery,项目名称:test-infra,代码行数:8,代码来源:kubernetes_e2e_test.py


示例10: test_local

    def test_local(self):
        """Make sure local mode is fine overall."""
        args = kubernetes_e2e.parse_args()
        with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
            kubernetes_e2e.main(args)

        self.assertNotEqual(self.envs, {})
        for call in self.callstack:
            self.assertFalse(call.startswith('docker'))
开发者ID:Kashomon,项目名称:test-infra,代码行数:9,代码来源:kubernetes_e2e_test.py


示例11: test_default_tag

 def test_default_tag(self):
     """Ensure the default tag exists on gcr.io."""
     args = kubernetes_e2e.parse_args()
     match = re.match('gcr.io/([^:]+):(.+)', kubernetes_e2e.kubekins(args.tag))
     self.assertIsNotNone(match)
     url = 'https://gcr.io/v2/%s/manifests/%s' % (match.group(1),
                                                  match.group(2))
     data = json.loads(urllib.urlopen(url).read())
     self.assertNotIn('errors', data)
     self.assertIn('name', data)
开发者ID:mikedanese,项目名称:test-infra,代码行数:10,代码来源:kubernetes_e2e_test.py


示例12: test_docker

    def test_docker(self):
        """Make sure docker mode is fine overall."""
        args = kubernetes_e2e.parse_args(['--mode=docker'])
        self.assertEqual(args.mode, 'docker')
        with Stub(kubernetes_e2e, 'check_env', fake_bomb):
            kubernetes_e2e.main(args)

        self.assertEqual(self.envs, {})
        call = self.callstack[-2]
        self.assertTrue(call.startswith('docker'), call)
开发者ID:mikedanese,项目名称:test-infra,代码行数:10,代码来源:kubernetes_e2e_test.py


示例13: test_env_local

 def test_env_local(self):
     env = 'FOO'
     value = 'BLAT'
     args = kubernetes_e2e.parse_args([
         '--mode=local',
         '--env={env}={value}'.format(env=env, value=value),
     ])
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         kubernetes_e2e.main(args)
     self.assertIn(env, self.envs)
     self.assertEqual(self.envs[env], value)
开发者ID:ihmccreery,项目名称:test-infra,代码行数:11,代码来源:kubernetes_e2e_test.py


示例14: test_use_shared_build

 def test_use_shared_build(self):
     # normal path
     args = kubernetes_e2e.parse_args([
         '--use-shared-build=bazel'
     ])
     def expect_bazel_gcs(path):
         bazel_default = os.path.join(
             'gs://kubernetes-jenkins/shared-results', 'bazel-build-location.txt')
         self.assertEqual(path, bazel_default)
         return always_kubernetes()
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         with Stub(kubernetes_e2e, 'read_gcs_path', expect_bazel_gcs):
             with Stub(time, 'sleep', fake_pass):
                 kubernetes_e2e.main(args)
     lastcall = self.callstack[-1]
     self.assertIn('--extract=kubernetes', lastcall)
     # normal path, not bazel
     args = kubernetes_e2e.parse_args([
         '--use-shared-build'
     ])
     def expect_normal_gcs(path):
         bazel_default = os.path.join(
             'gs://kubernetes-jenkins/shared-results', 'build-location.txt')
         self.assertEqual(path, bazel_default)
         return always_kubernetes()
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         with Stub(kubernetes_e2e, 'read_gcs_path', expect_normal_gcs):
             kubernetes_e2e.main(args)
     lastcall = self.callstack[-1]
     self.assertIn('--extract=kubernetes', lastcall)
     # test failure to read shared path from GCS
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         with Stub(kubernetes_e2e, 'read_gcs_path', raise_urllib2_error):
             with Stub(os, 'getcwd', always_kubernetes):
                 with Stub(time, 'sleep', fake_pass):
                     try:
                         kubernetes_e2e.main(args)
                     except RuntimeError as err:
                         if not err.message.startswith('Failed to get shared build location'):
                             raise err
开发者ID:ihmccreery,项目名称:test-infra,代码行数:40,代码来源:kubernetes_e2e_test.py


示例15: test_kubeadm_pull

    def test_kubeadm_pull(self):
        """Make sure kubeadm pull mode is fine overall."""
        args = kubernetes_e2e.parse_args(['--mode=local', '--kubeadm=pull'])
        self.assertEqual(args.mode, 'local')
        self.assertEqual(args.kubeadm, 'pull')
        fake_env = {'PULL_NUMBER': 1234, 'PULL_REFS': 'master:abcd'}
        with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
            with Stub(os, 'environ', fake_env):
                kubernetes_e2e.main(args)

        self.assertNotIn('E2E_OPT', self.envs)
        version = 'gs://kubernetes-release-dev/bazel/1234/master:abcd/bin/linux/amd64/'
        self.assertIn('--kubernetes-anywhere-kubeadm-version=%s' % version, self.callstack[-1])
开发者ID:mikedanese,项目名称:test-infra,代码行数:13,代码来源:kubernetes_e2e_test.py


示例16: test_default_tag

 def test_default_tag(self):
     """Ensure the default tag exists on gcr.io."""
     args = kubernetes_e2e.parse_args()
     match = re.match('gcr.io/([^:]+):(.+)', kubernetes_e2e.kubekins(args.tag))
     self.assertIsNotNone(match)
     url = 'https://gcr.io/v2/%s/manifests/%s' % (match.group(1),
                                                  match.group(2))
     req = urllib2.Request(url)
     req.add_header('Accept', 'application/vnd.docker.distribution.manifest.v2+json')
     data = json.loads(urllib2.urlopen(req).read())
     self.assertNotIn('errors', data)
     self.assertIn('config', data)
     self.assertIn('digest', data.get('config'))
开发者ID:krousey,项目名称:test-infra,代码行数:13,代码来源:kubernetes_e2e_test.py


示例17: test_image_family

 def test_image_family(self):
     """Make sure --image-family fetches the latest image correctly."""
     args = kubernetes_e2e.parse_args([
         '--mode=local',
         '--image-family=cos-stable',
         '--image-project=cos-cloud'])
     with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
         with Stub(
             kubernetes_e2e,
             'check_output',
             self.fake_output_get_latest_image):
             kubernetes_e2e.main(args)
     self.assertEqual(
         self.envs['KUBE_GCE_NODE_IMAGE'], 'cos-stable-59-9460-64-0')
     self.assertEqual(self.envs['KUBE_GCE_NODE_PROJECT'], 'cos-cloud')
开发者ID:mikedanese,项目名称:test-infra,代码行数:15,代码来源:kubernetes_e2e_test.py


示例18: test_kubeadm_periodic

    def test_kubeadm_periodic(self):
        """Make sure kubeadm periodic mode is fine overall."""
        args = kubernetes_e2e.parse_args(['--kubeadm=periodic'])
        self.assertEqual(args.kubeadm, 'periodic')
        with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
            with Stub(kubernetes_e2e, 'check_output', self.fake_output_work_status):
                kubernetes_e2e.main(args)

        self.assertNotIn('E2E_OPT', self.envs)
        version = 'gs://kubernetes-release-dev/ci/v1.7.0-alpha.0.1320+599539dc0b9997-bazel/bin/linux/amd64/'  # pylint: disable=line-too-long
        self.assertIn('--kubernetes-anywhere-kubeadm-version=%s' % version, self.callstack[-1])
        called = False
        for call in self.callstack:
            self.assertFalse(call.startswith('docker'))
            if call == 'hack/print-workspace-status.sh':
                called = True
        self.assertTrue(called)
开发者ID:Kashomon,项目名称:test-infra,代码行数:17,代码来源:kubernetes_e2e_test.py


示例19: test_kubeadm_periodic_v1_6

    def test_kubeadm_periodic_v1_6(self):
        """Make sure kubeadm periodic mode has correct version on v1.6"""
        args = kubernetes_e2e.parse_args(['--mode=local', '--kubeadm=periodic'])
        self.assertEqual(args.mode, 'local')
        self.assertEqual(args.kubeadm, 'periodic')
        with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
            with Stub(kubernetes_e2e, 'check_output', self.fake_output_work_status_v1_6):
                kubernetes_e2e.main(args)

        self.assertNotIn('E2E_OPT', self.envs)
        version = 'gs://kubernetes-release-dev/bazel/v1.6.4-beta.0.18+84febd4537dd19/build/debs/'
        self.assertIn('--kubernetes-anywhere-kubeadm-version=%s' % version, self.callstack[-1])
        called = False
        for call in self.callstack:
            self.assertFalse(call.startswith('docker'))
            if call == 'hack/print-workspace-status.sh':
                called = True
        self.assertTrue(called)
开发者ID:mikedanese,项目名称:test-infra,代码行数:18,代码来源:kubernetes_e2e_test.py


示例20: test_kops_gce

    def test_kops_gce(self):
        temp = tempfile.NamedTemporaryFile()
        args = kubernetes_e2e.parse_args([
            '--provider=gce',
            '--deployment=kops',
            '--cluster=foo.example.com',
            '--gce-ssh=%s' % temp.name,
            '--gce-pub=%s' % temp.name,
            ])
        with Stub(kubernetes_e2e, 'check_env', self.fake_check_env):
            kubernetes_e2e.main(args)

        lastcall = self.callstack[-1]
        self.assertIn('kubetest', lastcall)
        self.assertIn('--provider=gce', lastcall)
        self.assertIn('--deployment=kops', lastcall)
        self.assertIn('--kops-cluster=foo.example.com', lastcall)
        self.assertIn('--kops-zones', lastcall)
        self.assertIn('--kops-state=gs://k8s-kops-gce/', lastcall)
        self.assertIn('--kops-nodes=4', lastcall)
        self.assertIn('--kops-ssh-key', lastcall)
开发者ID:krousey,项目名称:test-infra,代码行数:21,代码来源:kubernetes_e2e_test.py



注:本文中的kubernetes_e2e.parse_args函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。