1 # Copyright 2022 Canonical Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from unittest
import TestCase
16 from osm_lcm
.osm_config
import OsmConfigBuilder
19 class TestOsmConfig(TestCase
):
20 def test_k8s_services(self
):
25 "type": "LoadBalancer",
26 "external_ip": ["1.1.1.1"],
27 "ports": [{"name": "ldap", "port": 1234, "protocol": "TCP"}],
30 "name": "ldap-internal",
32 "cluster_ip": "10.10.10.10",
34 {"name": "ldap-internal", "port": 1234, "protocol": "TCP"}
41 "type": "LoadBalancer",
43 "ports": {"ldap": {"port": 1234, "protocol": "TCP"}},
47 "ip": ["10.10.10.10"],
48 "ports": {"ldap-internal": {"port": 1234, "protocol": "TCP"}},
52 OsmConfigBuilder(k8s
=input_services
).build(),
53 {"v0": {"k8s": {"services": expected_services
}}},