def deployment(self): with mock.patch("k8s.models.deployment.Deployment.get") as m: deployment = mock.create_autospec(Deployment(), spec_set=True) deployment.spec.replicas.return_value = REPLICAS m.return_value = deployment return deployment
def test_create_blank_deployment(self): object_meta = ObjectMeta(name=NAME, namespace=NAMESPACE) deployment = Deployment(metadata=object_meta) assert deployment.as_dict()[u"metadata"][u"name"] == NAME
def deployment(self): main_container = Container(env=[EnvVar(name="DUMMY", value="CANARY")]) pod_spec = PodSpec(containers=[main_container]) pod_template_spec = PodTemplateSpec(spec=pod_spec) deployment_spec = DeploymentSpec(template=pod_template_spec) return Deployment(spec=deployment_spec)