aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2024-03-26 12:56:41 +0100
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2024-03-26 15:08:58 +0100
commit7801bc09e09b7816c7690f14bc18afd013c5e70a (patch)
tree43e4b556e68747734e545a33d0949cd65e456cce
parent4a99e7286857a83a9e2c557263363228f410bac8 (diff)
Fix SDC v2 distribution status - desird status
If DOWNLOAD_OK check not for all components Issue-ID: TEST-404 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> Change-Id: I4111ceb8b3aeb69023d8c80a80b6ef57c95b9575
-rw-r--r--src/onapsdk/configuration/global_settings.py9
-rw-r--r--src/onapsdk/sdc2/service.py5
-rw-r--r--src/onapsdk/version.py2
-rw-r--r--tests/test_sdc2_service.py16
-rw-r--r--tests/test_settings.py3
-rw-r--r--tests/test_version.py2
6 files changed, 31 insertions, 6 deletions
diff --git a/src/onapsdk/configuration/global_settings.py b/src/onapsdk/configuration/global_settings.py
index 8bfea14..32eedcd 100644
--- a/src/onapsdk/configuration/global_settings.py
+++ b/src/onapsdk/configuration/global_settings.py
@@ -84,3 +84,12 @@ SDC_SERVICE_DISTRIBUTION_COMPONENTS = [
"policy-distribution-id",
"multicloud-k8s"
]
+
+# SDC DISTRIBUTION DESIRD STATE
+# FOR OTHER COMPONENTS NOTIFICATION IS ENOUGH
+SDC_SERVICE_DISTRIBUTION_DESIRED_STATE = {
+ "SO-sdc-controller": "DOWNLOAD_OK",
+ "aai-model-loader": "DOWNLOAD_OK",
+ "sdnc-sdc-listener": "DOWNLOAD_OK",
+ "policy-distribution-id": "DOWNLOAD_OK",
+}
diff --git a/src/onapsdk/sdc2/service.py b/src/onapsdk/sdc2/service.py
index 079fff5..e7e76e9 100644
--- a/src/onapsdk/sdc2/service.py
+++ b/src/onapsdk/sdc2/service.py
@@ -68,7 +68,10 @@ class ServiceDistribution(SDC):
bool: True if distribution of component was completed.
"""
- return self.status == "DOWNLOAD_OK"
+ return not self.failed and (
+ self.component_id not in settings.SDC_SERVICE_DISTRIBUTION_DESIRED_STATE
+ or self.status == settings.SDC_SERVICE_DISTRIBUTION_DESIRED_STATE[
+ self.component_id])
@property
def failed(self) -> bool:
diff --git a/src/onapsdk/version.py b/src/onapsdk/version.py
index 33acbae..7e00970 100644
--- a/src/onapsdk/version.py
+++ b/src/onapsdk/version.py
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-__version__ = "13.0.6"
+__version__ = "13.0.7"
diff --git a/tests/test_sdc2_service.py b/tests/test_sdc2_service.py
index 23fab64..5be7b6d 100644
--- a/tests/test_sdc2_service.py
+++ b/tests/test_sdc2_service.py
@@ -546,9 +546,21 @@ def test_service_distribution_distribution_components_test(mock_distribution_sta
ServiceDistribution.DistributionStatus(
component_id=component_id,
timestamp=str(randint(0, maxsize)),
+ status=str(uuid4()),
+ url=str(uuid4()),
+ error_reason="null"
+ ) for component_id in list(
+ settings.SDC_SERVICE_DISTRIBUTION_DESIRED_STATE.keys())
+ ]
+ assert sd._distribution_components_test is False
+
+ mock_distribution_status_list.return_value = [
+ ServiceDistribution.DistributionStatus(
+ component_id=component_id,
+ timestamp=str(randint(0, maxsize)),
status="DOWNLOAD_OK",
url=str(uuid4()),
- error_reason=str(uuid4())
+ error_reason="null"
) for component_id in settings.SDC_SERVICE_DISTRIBUTION_COMPONENTS
]
assert sd._distribution_components_test is True
@@ -559,7 +571,7 @@ def test_service_distribution_distribution_components_test(mock_distribution_sta
timestamp=str(randint(0, maxsize)),
status="DOWNLOAD_OK",
url=str(uuid4()),
- error_reason=str(uuid4())
+ error_reason="null"
) for component_id in settings.SDC_SERVICE_DISTRIBUTION_COMPONENTS + ["additional-test-component"]
]
assert sd._distribution_components_test is True
diff --git a/tests/test_settings.py b/tests/test_settings.py
index 154eed0..96ec460 100644
--- a/tests/test_settings.py
+++ b/tests/test_settings.py
@@ -24,7 +24,7 @@ from onapsdk.exceptions import ModuleError
def test_global_settings():
"""Test global settings."""
- assert len(settings._settings) == 49
+ assert len(settings._settings) == 50
assert settings.AAI_URL == "https://aai.api.sparky.simpledemo.onap.org:30233"
assert settings.CDS_URL == "http://portal.api.simpledemo.onap.org:30449"
assert settings.SDNC_URL == "https://sdnc.api.simpledemo.onap.org:30267"
@@ -66,6 +66,7 @@ def test_global_settings():
assert hasattr(settings, "SO_AUTH")
assert hasattr(settings, "SO_CAT_DB_AUTH")
assert hasattr(settings, "SDC_SERVICE_DISTRIBUTION_COMPONENTS")
+ assert hasattr(settings, "SDC_SERVICE_DISTRIBUTION_DESIRED_STATE")
def test_settings_load_custom():
"""Test if custom settings is loaded correctly."""
diff --git a/tests/test_version.py b/tests/test_version.py
index 9afad27..488c129 100644
--- a/tests/test_version.py
+++ b/tests/test_version.py
@@ -17,4 +17,4 @@ import onapsdk.version as version
def test_version():
"""Check version is the right one."""
- assert version.__version__ == '13.0.6'
+ assert version.__version__ == '13.0.7'