1 # ============LICENSE_START=======================================================
3 # ================================================================================
4 # Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
19 # Test k8sclient deployment functions
20 # Verify that for a given configuration and set of inputs, k8sclient generates the proper
24 from common import do_deploy
26 def test_deploy_full_tls(mockk8sapi):
27 ''' Deploy component with a full TLS configuration, to act as a server '''
29 dep, deployment_description = do_deploy({"use_tls": True, "cert_directory": "/path/to/container/cert/directory" })
31 app_container = dep.spec.template.spec.containers[0]
32 assert app_container.volume_mounts[2].mount_path == "/path/to/container/cert/directory"
34 def test_deploy_tls_off(mockk8sapi):
35 ''' TLS client only, but with cert directory configured '''
37 dep, deployment_description = do_deploy({"use_tls": False, "cert_directory": "/path/to/container/cert/directory" })
39 app_container = dep.spec.template.spec.containers[0]
40 assert app_container.volume_mounts[2].mount_path == "/path/to/container/cert/directory"
42 def test_deploy_no_tls_info(mockk8sapi):
43 ''' TLS client only, but with cert directory configured '''
45 dep, deployment_description = do_deploy()
47 app_container = dep.spec.template.spec.containers[0]
48 assert app_container.volume_mounts[2].mount_path == "/opt/dcae/cacert"