Exemple #1
0
 def test_bad_yaml(self, manifest_dir):
     """Test specifying a file that is not valid YAML."""
     with pytest.raises(yaml.YAMLError):
         manifest.load_type(
             client.V1Container,
             os.path.join(manifest_dir, 'invalid.yaml')
         )
Exemple #2
0
 def test_bad_path(self, manifest_dir):
     """Test specifying an invalid manifest path."""
     with pytest.raises(FileNotFoundError):
         manifest.load_type(
             client.V1Container,
             os.path.join(manifest_dir, 'foo', 'bar', 'baz.yaml')
         )
 def test_simple_deployment_wrong_type(self, manifest_dir):
     """Test loading the simple deployment to the wrong type."""
     with pytest.raises(ValueError):
         # The V1Container requires a name -- since the manifest has no name,
         # it will cause V1Container construction to fail with ValueError.
         manifest.load_type(
             client.V1Container,
             os.path.join(manifest_dir, 'simple-deployment.yaml'))
Exemple #4
0
 def test_simple_networkpolicy_wrong_type(self, manifest_dir):
     """Test loading the simple networkpolicy to the wrong type."""
     with pytest.raises(ValueError):
         # The V1Container requires a name -- since the manifest has no name,
         # it will cause V1Container construction to fail with ValueError.
         manifest.load_type(
             client.V1Container,
             os.path.join(manifest_dir, "simple-networkpolicy.yaml"),
         )
Exemple #5
0
 def test_simple_serviceaccount_ok(self, manifest_dir,
                                   simple_serviceaccount):
     """Test loading the simple serviceaccount successfully."""
     obj = manifest.load_type(
         client.V1ServiceAccount,
         os.path.join(manifest_dir, 'simple-serviceaccount.yaml'))
     assert obj == simple_serviceaccount
Exemple #6
0
 def test_simple_persistentvolumeclaim_ok(self, manifest_dir,
                                          simple_persistentvolumeclaim):
     """Test loading the simple persistentvolumeclaim successfully."""
     obj = manifest.load_type(
         client.V1PersistentVolumeClaim,
         os.path.join(manifest_dir, 'simple-persistentvolumeclaim.yaml'))
     assert obj == simple_persistentvolumeclaim
Exemple #7
0
 def test_simple_networkpolicy_ok(self, manifest_dir, simple_networkpolicy):
     """Test loading the simple networkpolicy successfully."""
     obj = manifest.load_type(
         client.V1NetworkPolicy,
         os.path.join(manifest_dir, "simple-networkpolicy.yaml"),
     )
     assert obj == simple_networkpolicy
Exemple #8
0
 def test_simple_ingress_ok(self, manifest_dir, simple_ingress):
     """Test loading the simple service successfully."""
     obj = manifest.load_type(
         client.ExtensionsV1beta1Ingress,
         os.path.join(manifest_dir, "simple-ingress.yaml"),
     )
     assert obj == simple_ingress
Exemple #9
0
 def test_simple_deployment_ok(self, manifest_dir, simple_deployment):
     """Test loading the simple deployment successfully."""
     obj = manifest.load_type(
         client.V1Deployment,
         os.path.join(manifest_dir, 'simple-deployment.yaml')
     )
     assert obj == simple_deployment
Exemple #10
0
 def test_simple_daemonset_ok(self, manifest_dir, simple_daemonset):
     """Test loading the simple daemonset successfully."""
     obj = manifest.load_type(
         client.V1DaemonSet,
         os.path.join(manifest_dir, 'simple-daemonset.yaml')
     )
     assert obj == simple_daemonset
Exemple #11
0
 def test_simple_statefulset_ok(self, manifest_dir, simple_statefulset):
     """Test loading the simple statefulset successfully."""
     obj = manifest.load_type(
         client.V1StatefulSet,
         os.path.join(manifest_dir, 'simple-statefulset.yaml')
     )
     assert obj == simple_statefulset
Exemple #12
0
 def test_simple_replicaset_ok(self, manifest_dir, simple_replicaset):
     """Test loading the simple ReplicaSet successfully."""
     obj = manifest.load_type(
         client.V1ReplicaSet,
         os.path.join(manifest_dir, 'simple-replicaset.yaml'))
     assert obj == simple_replicaset
Exemple #13
0
 def test_simple_service_ok(self, manifest_dir, simple_service):
     """Test loading the simple service successfully."""
     obj = manifest.load_type(
         client.V1Service, os.path.join(manifest_dir,
                                        "simple-service.yaml"))
     assert obj == simple_service