Beispiel #1
0
 def test_resource_custom_label(self):
     resource = Resource(
         APP, NODE, {"metadata": {"labels": {"custom-label": "custom"}}}
     )
     compare = DEFAULT_RESOURCE["metadata"]["labels"].keys()
     self.assertGreaterEqual(resource.labels.keys(), compare)
     self.assertEqual(resource.labels["custom-label"], "custom")
Beispiel #2
0
 def test_validate_apiversion(self):
     resource = Resource(APP, NODE, {"kind": "BadKindName"})
     with self.assertRaises(ValueError):
         resource._validate()
Beispiel #3
0
 def test_validate_kind(self):
     resource = Resource(APP, NODE, {"kind": ""})
     with self.assertRaises(ValueError):
         resource._validate()
Beispiel #4
0
 def test_resource_custom_namespace(self):
     resource = Resource(APP, NODE, {"metadata": {"namespace": "custom"}})
     self.assertEqual(resource.manifest["metadata"]["namespace"], "custom")
     self.assertEqual(resource.namespace, "custom")
Beispiel #5
0
 def test_resource_custom_kind(self):
     resource = Resource(APP, NODE, {"kind": "StatefulSet"})
     self.assertEqual(resource.manifest["kind"], "StatefulSet")
Beispiel #6
0
 def test_resource_custom_name(self):
     resource = Resource(APP, NODE, {"metadata": {"name": "custom"}})
     self.assertEqual(resource.labels["app.kubernetes.io/name"], "custom")
     self.assertEqual(resource.manifest["metadata"]["name"], "custom")
     self.assertEqual(resource.name, "custom")
Beispiel #7
0
 def test_resource_metadata_keys(self):
     resource = Resource(APP, NODE, {})
     compare = DEFAULT_RESOURCE["metadata"].keys()
     self.assertEqual(compare, resource.manifest["metadata"].keys())
Beispiel #8
0
 def test_resource_label_keys(self):
     resource = Resource(APP, NODE, {})
     compare = DEFAULT_RESOURCE["metadata"]["labels"].keys()
     self.assertEqual(compare, resource.labels.keys())
Beispiel #9
0
 def test_resource_keys(self):
     resource = Resource(APP, NODE, {})
     compare = DEFAULT_RESOURCE.keys()
     self.assertEqual(compare, resource.manifest.keys())