コード例 #1
0
 def test_valid_yaml_invalid_resource(self, context):
     config = KubeConfig(contexts=[context])
     with config.as_tempfile() as fname:
         client = KubectlClusterClient(KUBECTL_BIN, kubeconfig=fname)
         tmpl = textwrap.dedent('''
         - invalid
         - valid
         - resource
         ''')
         with pytest.raises(KubectlExecutionError):
             client.apply(tmpl)
         with pytest.raises(KubectlExecutionError):
             client.delete(tmpl)
コード例 #2
0
 def test_normal(self, context):
     config = KubeConfig(contexts=[context])
     with config.as_tempfile() as fname:
         client = KubectlClusterClient(KUBECTL_BIN, kubeconfig=fname)
         tmpl = textwrap.dedent('''
         apiVersion: v1
         data:
             hello: world
         kind: ConfigMap
         metadata:
             creationTimestamp: null
             name: bcs-unitest-c1
         ''')
         client.apply(tmpl)
         client.delete(tmpl)
コード例 #3
0
 def test_invalid_format(self, context):
     config = KubeConfig(contexts=[context])
     with config.as_tempfile() as fname:
         client = KubectlClusterClient(KUBECTL_BIN, kubeconfig=fname)
         with pytest.raises(KubectlExecutionError):
             client.apply("invalid_template")