From 616b0760dca131ec703d667d27c256d109944b2b Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Thu, 1 Jul 2021 07:50:45 +0100 Subject: Add Junits for kubernetes participant module Overall coverage for the module: 85% Issue-ID: POLICY-3241 Signed-off-by: zrrmmua Change-Id: I00c7866ae598b9768d1616468a4c9bfe4cc76166 --- .../src/test/resources/ChartList.json | 15 ++ .../src/test/resources/KubernetesHelm.yaml | 154 --------------------- .../src/test/resources/application_test.properties | 26 ++++ .../resources/servicetemplates/KubernetesHelm.yaml | 154 +++++++++++++++++++++ 4 files changed, 195 insertions(+), 154 deletions(-) create mode 100644 participant/participant-impl/participant-impl-kubernetes/src/test/resources/ChartList.json delete mode 100644 participant/participant-impl/participant-impl-kubernetes/src/test/resources/KubernetesHelm.yaml create mode 100644 participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties create mode 100644 participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test/resources') diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/ChartList.json b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/ChartList.json new file mode 100644 index 000000000..4e355c38e --- /dev/null +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/ChartList.json @@ -0,0 +1,15 @@ +{ + "charts" : [ + { + "chartName" : "HelloWorld", + "version" : "1.0", + "namespace" : "onap", + "repository" : "chartMuseum" + }, + { + "chartName" : "nginx", + "version" : "1.1", + "namespace" : "onap" + } + ] +} diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/KubernetesHelm.yaml b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/KubernetesHelm.yaml deleted file mode 100644 index 3212b5ad2..000000000 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/KubernetesHelm.yaml +++ /dev/null @@ -1,154 +0,0 @@ -# ============LICENSE_START======================================================= -# Copyright (C) 2021 Nordix Foundation. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 -# ============LICENSE_END========================================================= -tosca_definitions_version: tosca_simple_yaml_1_3 -data_types: - onap.datatypes.ToscaConceptIdentifier: - derived_from: tosca.datatypes.Root - properties: - name: - type: string - required: true - version: - type: string - required: true -node_types: - org.onap.policy.clamp.controlloop.Participant: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - requred: false - org.onap.policy.clamp.controlloop.ControlLoopElement: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - requred: false - participant_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: true - org.onap.policy.clamp.controlloop.ControlLoop: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - requred: false - elements: - type: list - required: true - entry_schema: - type: onap.datatypes.ToscaConceptIdentifier - org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement: - version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement - properties: - chart: - type: string - required: true - configs: - type: list - required: false - requirements: - type: string - requred: false - templates: - type: list - required: false - entry_schema: - values: - type: string - requred: true -topology_template: - node_templates: - org.onap.k8s.controlloop.K8SControlLoopParticipant: - version: 2.3.4 - type: org.onap.policy.clamp.controlloop.Participant - type_version: 1.0.1 - description: Participant for K8S - properties: - provider: ONAP - - org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement: - # Chart from any chart repository configured on helm client. - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement - type_version: 1.0.0 - description: Control loop element for the K8S microservice for Hello World - properties: - provider: ONAP - participant_id: - name: org.onap.k8s.controlloop.K8SControlLoopParticipant - version: 2.3.4 - chart: - release_name: helloworld - chart_name: hello - version: 0.1.0 - repository: chartMuseum - namespace: onap - - org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement: - # Chart from local file system - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement - type_version: 1.0.0 - description: Control loop element for the K8S microservice for PMSH - properties: - provider: ONAP - participant_id: - name: org.onap.k8s.controlloop.K8SControlLoopParticipant - version: 2.3.4 - chart: - release_name: pmshmicroservice - chart_name: test - version: 1.0.1 - namespace: onap - - org.onap.domain.database.Local_K8SMicroserviceControlLoopElement: - # Chart installation without passing repository name - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement - type_version: 1.0.0 - description: Control loop element for the K8S microservice for local chart - properties: - provider: ONAP - participant_id: - name: org.onap.k8s.controlloop.K8SControlLoopParticipant - version: 2.3.4 - chart: - release_name: nginxms - chart_name: nginx-ingress - version: 0.9.1 - namespace: onap - - org.onap.domain.sample.GenericK8s_ControlLoopDefinition: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.ControlLoop - type_version: 1.0.0 - description: Control loop for Hello World - properties: - provider: ONAP - elements: - - name: org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement - version: 1.2.3 - - name: org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement - version: 1.2.3 - - name: org.onap.domain.database.Local_K8SMicroserviceControlLoopElement - version: 1.2.3 diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties new file mode 100644 index 000000000..188623af0 --- /dev/null +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application_test.properties @@ -0,0 +1,26 @@ +spring.security.user.name=healthcheck +spring.security.user.password=zb!XztG34 + +server.servlet.context-path=/onap/participantsim +server.error.path=/error +server.http-port=8083 + +participant.name=ControlLoopParticipant Kubernetes Test +participant.intermediaryParameters.name=Participant parameters +participant.intermediaryParameters.reportingTimeInterval=120000 +participant.intermediaryParameters.description=Participant Description +participant.intermediaryParameters.participantId.name=K8sParticipant0 +participant.intermediaryParameters.participantId.version=1.0.0 +participant.intermediaryParameters.participantType.name=org.onap.k8s.controlloop.K8SControlLoopParticipant +participant.intermediaryParameters.participantType.version=2.3.4 +participant.intermediaryParameters.clampControlLoopTopics.name=ControlLoop Topics +participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT +participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost +participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap +participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000 +participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT +participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost +participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap +participant.intermediaryParameters.clampControlLoopTopics.topicSinks[1].topic=POLICY-NOTIFICATION +participant.intermediaryParameters.clampControlLoopTopics.topicSinks[1].servers[0]=localhost +participant.intermediaryParameters.clampControlLoopTopics.topicSinks[1].topicCommInfrastructure=dmaap diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml new file mode 100644 index 000000000..3212b5ad2 --- /dev/null +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/servicetemplates/KubernetesHelm.yaml @@ -0,0 +1,154 @@ +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +tosca_definitions_version: tosca_simple_yaml_1_3 +data_types: + onap.datatypes.ToscaConceptIdentifier: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + version: + type: string + required: true +node_types: + org.onap.policy.clamp.controlloop.Participant: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + org.onap.policy.clamp.controlloop.ControlLoopElement: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + participant_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.ControlLoop: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + elements: + type: list + required: true + entry_schema: + type: onap.datatypes.ToscaConceptIdentifier + org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + chart: + type: string + required: true + configs: + type: list + required: false + requirements: + type: string + requred: false + templates: + type: list + required: false + entry_schema: + values: + type: string + requred: true +topology_template: + node_templates: + org.onap.k8s.controlloop.K8SControlLoopParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for K8S + properties: + provider: ONAP + + org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement: + # Chart from any chart repository configured on helm client. + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the K8S microservice for Hello World + properties: + provider: ONAP + participant_id: + name: org.onap.k8s.controlloop.K8SControlLoopParticipant + version: 2.3.4 + chart: + release_name: helloworld + chart_name: hello + version: 0.1.0 + repository: chartMuseum + namespace: onap + + org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement: + # Chart from local file system + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the K8S microservice for PMSH + properties: + provider: ONAP + participant_id: + name: org.onap.k8s.controlloop.K8SControlLoopParticipant + version: 2.3.4 + chart: + release_name: pmshmicroservice + chart_name: test + version: 1.0.1 + namespace: onap + + org.onap.domain.database.Local_K8SMicroserviceControlLoopElement: + # Chart installation without passing repository name + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the K8S microservice for local chart + properties: + provider: ONAP + participant_id: + name: org.onap.k8s.controlloop.K8SControlLoopParticipant + version: 2.3.4 + chart: + release_name: nginxms + chart_name: nginx-ingress + version: 0.9.1 + namespace: onap + + org.onap.domain.sample.GenericK8s_ControlLoopDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoop + type_version: 1.0.0 + description: Control loop for Hello World + properties: + provider: ONAP + elements: + - name: org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement + version: 1.2.3 + - name: org.onap.domain.database.PMSH_K8SMicroserviceControlLoopElement + version: 1.2.3 + - name: org.onap.domain.database.Local_K8SMicroserviceControlLoopElement + version: 1.2.3 -- cgit 1.2.3-korg