Add VCA Integrator Charm
[osm/devops.git] / installers / charm / vca-integrator-operator / tests / integration / test_charm.py
1 #!/usr/bin/env python3
2 #######################################################################################
3 # Copyright ETSI Contributors and Others.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #######################################################################################
18
19 import logging
20 from pathlib import Path
21
22 import pytest
23 import yaml
24 from pytest_operator.plugin import OpsTest
25
26 logger = logging.getLogger(__name__)
27
28 METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
29
30
31 @pytest.mark.abort_on_fail
32 async def test_build_and_deploy(ops_test: OpsTest):
33 """Build the charm osm-vca-integrator-k8s and deploy it together with related charms.
34
35 Assert on the unit status before any relations/configurations take place.
36 """
37 await ops_test.model.set_config({"update-status-hook-interval": "10s"})
38
39 charm = await ops_test.build_charm(".")
40 await ops_test.model.deploy(charm, application_name="osm-vca-integrator-k8s")
41 await ops_test.model.wait_for_idle(
42 apps=["osm-vca-integrator-k8s"], status="blocked", timeout=1000
43 )
44 assert (
45 ops_test.model.applications["osm-vca-integrator-k8s"].units[0].workload_status == "blocked"
46 )
47
48 logger.debug("Setting update-status-hook-interval to 60m")
49 await ops_test.model.set_config({"update-status-hook-interval": "60m"})