def test_shorten_name(self, config, suffix, expected): config.use_ingress_tls = "default_on" config.ingress_suffixes = [suffix] tls = IngressTls(config) actual = tls._generate_short_host(app_spec()) assert len(actual) < 64 assert expected == actual
def test_raise_when_name_starts_with_dot(self, config): config.use_ingress_tls = "default_on" config.ingress_suffixes = [ "really.long.suffix.which.goes.to.the.very.edge.of.the.boundary" ] tls = IngressTls(config) with pytest.raises(ValueError): tls._generate_short_host(app_spec())
def test_raise_when_suffix_too_long(self, config): config.use_ingress_tls = "default_on" config.ingress_suffixes = [ "this.suffix.is.so.long.that.it.is.impossible.to.generate.a.short.enough.name" ] tls = IngressTls(config) with pytest.raises(ValueError): tls._generate_short_host(app_spec())
def tls(self, request, config): config.use_ingress_tls = request.param["use_ingress_tls"] config.tls_certificate_issuer = request.param["cert_issuer"] config.ingress_suffixes = ["short.suffix", "really.quite.long.suffix"] config.enable_deprecated_tls_entry_per_host = request.param[ "enable_deprecated_tls_entry_per_host"] return IngressTls(config)
def tls(self, request, config): config.use_ingress_tls = request.param["use_ingress_tls"] config.tls_certificate_issuer = request.param["cert_issuer"] config.ingress_suffixes = ["short.suffix", "really.quite.long.suffix"] return IngressTls(config)
def ingress_tls(self, config): return mock.create_autospec(IngressTls(config), spec_set=True, instance=True)