summaryrefslogtreecommitdiffstats
path: root/adapter/acumos/tests
diff options
context:
space:
mode:
Diffstat (limited to 'adapter/acumos/tests')
-rw-r--r--adapter/acumos/tests/conftest.py3
-rw-r--r--adapter/acumos/tests/fixtures/config.yaml2
-rw-r--r--adapter/acumos/tests/fixtures/models/ArgsList_1.0.0_dcae_data_format.json2
-rw-r--r--adapter/acumos/tests/fixtures/models/SumOut_1.0.0_dcae_data_format.json2
-rw-r--r--adapter/acumos/tests/fixtures/models/example-model-listofm/metadata.json2
-rw-r--r--adapter/acumos/tests/fixtures/models/example-model/requirements.txt2
-rw-r--r--adapter/acumos/tests/test_docker.py4
-rw-r--r--adapter/acumos/tests/test_spec.py80
8 files changed, 69 insertions, 28 deletions
diff --git a/adapter/acumos/tests/conftest.py b/adapter/acumos/tests/conftest.py
index 4219f66..8fef707 100644
--- a/adapter/acumos/tests/conftest.py
+++ b/adapter/acumos/tests/conftest.py
@@ -2,6 +2,7 @@
# org.onap.dcae
# =============================================================================
# Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2021 highstreet technologies GmbH. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,7 +29,7 @@ from tests import testing_helpers
def mock_schemas(monkeypatch):
cwd = os.getcwd()
schemadir = cwd[:cwd.find('/adapter/acumos')] + '/mod/component-json-schemas'
- monkeypatch.setattr(aoconversion.utils.component_schema, 'path', schemadir + '/component-specification/dcae-cli-v2/component-spec-schema.json')
+ monkeypatch.setattr(aoconversion.utils.component_schema, 'path', schemadir + '/component-specification/dcae-cli-v3/component-spec-schema.json')
monkeypatch.setattr(aoconversion.utils.dataformat_schema, 'path', schemadir + '/data-format/dcae-cli-v1/data-format-schema.json')
monkeypatch.setattr(aoconversion.utils.schema_schema, 'ret', requests.get('https://json-schema.org/draft-04/schema#').json())
diff --git a/adapter/acumos/tests/fixtures/config.yaml b/adapter/acumos/tests/fixtures/config.yaml
index 207fe0c..b347258 100644
--- a/adapter/acumos/tests/fixtures/config.yaml
+++ b/adapter/acumos/tests/fixtures/config.yaml
@@ -7,4 +7,4 @@ certfile: /run/certs/cert.pem
dockerregistry: 'dockerregistry'
dockeruser: 'dockeruser'
dockerpass: 'dockerpass'
-port: '90' \ No newline at end of file
+port: '90'
diff --git a/adapter/acumos/tests/fixtures/models/ArgsList_1.0.0_dcae_data_format.json b/adapter/acumos/tests/fixtures/models/ArgsList_1.0.0_dcae_data_format.json
index 56b6e6e..ce874e4 100644
--- a/adapter/acumos/tests/fixtures/models/ArgsList_1.0.0_dcae_data_format.json
+++ b/adapter/acumos/tests/fixtures/models/ArgsList_1.0.0_dcae_data_format.json
@@ -1 +1 @@
-{"self": {"name": "ArgsList", "version": "1.0.0"}, "dataformatversion": "1.0.1", "jsonschema": {"title": "ArgsList", "type": "object", "properties": {"args": {"type": "array", "items": {"$ref": "#/definitions/Args"}}}, "$schema": "http://json-schema.org/draft-04/schema#", "definitions": {"Args": {"title": "Args", "type": "object", "properties": {"x": {"type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991}, "y": {"type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991}}}}}} \ No newline at end of file
+{"self": {"name": "ArgsList", "version": "1.0.0"}, "dataformatversion": "1.0.1", "jsonschema": {"title": "ArgsList", "type": "object", "properties": {"args": {"type": "array", "items": {"$ref": "#/definitions/Args"}}}, "$schema": "http://json-schema.org/draft-04/schema#", "definitions": {"Args": {"title": "Args", "type": "object", "properties": {"x": {"type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991}, "y": {"type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991}}}}}}
diff --git a/adapter/acumos/tests/fixtures/models/SumOut_1.0.0_dcae_data_format.json b/adapter/acumos/tests/fixtures/models/SumOut_1.0.0_dcae_data_format.json
index 3f7cdca..fb27276 100644
--- a/adapter/acumos/tests/fixtures/models/SumOut_1.0.0_dcae_data_format.json
+++ b/adapter/acumos/tests/fixtures/models/SumOut_1.0.0_dcae_data_format.json
@@ -1 +1 @@
-{"self": {"name": "SumOut", "version": "1.0.0"}, "dataformatversion": "1.0.1", "jsonschema": {"title": "SumOut", "type": "object", "properties": {"value": {"type": "array", "items": {"type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991}}}, "$schema": "http://json-schema.org/draft-04/schema#", "definitions": {}}} \ No newline at end of file
+{"self": {"name": "SumOut", "version": "1.0.0"}, "dataformatversion": "1.0.1", "jsonschema": {"title": "SumOut", "type": "object", "properties": {"value": {"type": "array", "items": {"type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991}}}, "$schema": "http://json-schema.org/draft-04/schema#", "definitions": {}}}
diff --git a/adapter/acumos/tests/fixtures/models/example-model-listofm/metadata.json b/adapter/acumos/tests/fixtures/models/example-model-listofm/metadata.json
index e9df2bd..5826015 100644
--- a/adapter/acumos/tests/fixtures/models/example-model-listofm/metadata.json
+++ b/adapter/acumos/tests/fixtures/models/example-model-listofm/metadata.json
@@ -1 +1 @@
-{"schema": "acumos.schema.model:0.4.0", "runtime": {"name": "python", "encoding": "protobuf", "version": "3.6.8", "dependencies": {"pip": {"indexes": [], "requirements": [{"name": "dill", "version": "0.3.0"}, {"name": "acumos", "version": "0.8.0"}]}, "conda": {"channels": [], "requirements": []}}}, "name": "example-model", "methods": {"sum": {"input": "ArgsList", "output": "SumOut", "description": ""}}} \ No newline at end of file
+{"schema": "acumos.schema.model:0.4.0", "runtime": {"name": "python", "encoding": "protobuf", "version": "3.6.8", "dependencies": {"pip": {"indexes": [], "requirements": [{"name": "dill", "version": "0.3.0"}, {"name": "acumos", "version": "0.8.0"}]}, "conda": {"channels": [], "requirements": []}}}, "name": "example-model", "methods": {"sum": {"input": "ArgsList", "output": "SumOut", "description": ""}}}
diff --git a/adapter/acumos/tests/fixtures/models/example-model/requirements.txt b/adapter/acumos/tests/fixtures/models/example-model/requirements.txt
new file mode 100644
index 0000000..033b24c
--- /dev/null
+++ b/adapter/acumos/tests/fixtures/models/example-model/requirements.txt
@@ -0,0 +1,2 @@
+dill==0.3.0
+acumos==0.8.0
diff --git a/adapter/acumos/tests/test_docker.py b/adapter/acumos/tests/test_docker.py
index bee53a0..37a2e39 100644
--- a/adapter/acumos/tests/test_docker.py
+++ b/adapter/acumos/tests/test_docker.py
@@ -2,7 +2,6 @@
# org.onap.dcae
# =============================================================================
# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
-# =============================================================================
# Copyright (c) 2021 highstreet technologies GmbH. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,7 +43,8 @@ def test_generate_dockerfile():
ENV no_proxy=
ENV NO_PROXY=
RUN pip install -r /app/requirements.txt && \
- pip install acumos_dcae_model_runner
+ pip install acumos_dcae_model_runner && \
+ pip install pyyaml
ENV DCAEPORT=10000
EXPOSE $DCAEPORT
diff --git a/adapter/acumos/tests/test_spec.py b/adapter/acumos/tests/test_spec.py
index 4771a1c..2b610b7 100644
--- a/adapter/acumos/tests/test_spec.py
+++ b/adapter/acumos/tests/test_spec.py
@@ -2,6 +2,7 @@
# org.onap.dcae
# =============================================================================
# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2021 highstreet technologies GmbH. All rights reserved.
# =============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,26 +28,63 @@ def test_generate_spec(mock_schemas):
Test generating data formats from the protobuf
"""
test_proto_path = get_fixture_path("models/example-model/model.proto")
- data_formats = dataformat_gen._generate_dcae_data_formats(test_proto_path, TEST_META, utils.dataformat_schema.get(), utils.schema_schema.get())
+ data_formats = dataformat_gen._generate_dcae_data_formats(test_proto_path, TEST_META, utils.dataformat_schema.get(),
+ utils.schema_schema.get())
assert spec_gen._generate_spec(
- "example-model", TEST_META, utils.component_schema.get(), data_formats, "nexus01.fake.com:18443/example-model:latest"
+ "example-model", TEST_META, utils.component_schema.get(), data_formats,
+ "latest"
) == {
- "self": {
- "version": "1.0.0",
- "name": "example-model",
- "description": "Automatically generated from Acumos model",
- "component_type": "docker",
- },
- "services": {"calls": [], "provides": []},
- "streams": {
- "subscribes": [
- {"config_key": "add_subscriber", "format": "NumbersIn", "version": "1.0.0", "type": "message_router"}
- ],
- "publishes": [
- {"config_key": "add_publisher", "format": "NumberOut", "version": "1.0.0", "type": "message_router"}
- ],
- },
- "parameters": [],
- "auxilary": {"healthcheck": {"type": "http", "endpoint": "/healthcheck"}},
- "artifacts": [{"type": "docker image", "uri": "nexus01.fake.com:18443/example-model:latest"}],
- }
+ "self": {
+ "version": "1.0.0",
+ "name": "example-model",
+ "description": "Automatically generated from Acumos model",
+ "component_type": "docker",
+ },
+ "services": {"calls": [], "provides": []},
+ "streams": {
+ "subscribes": [
+ {"config_key": "add_subscriber", "format": "NumbersIn", "version": "1.0.0",
+ "type": "message_router"}
+ ],
+ "publishes": [
+ {"config_key": "add_publisher", "format": "NumberOut", "version": "1.0.0",
+ "type": "message_router"}
+ ],
+ },
+ "parameters": [
+ {
+ "name": "streams_subscribes",
+ "value": "{\"add_subscriber\":{\"dmaap_info\":{\"topic_url\":\"http://message-router:3904/events/unauthenticated.example-model_In\"},\"type\":\"message_router\"}}",
+ "description": "standard http port collector will open for listening;",
+ "sourced_at_deployment": False,
+ "policy_editable": False,
+ "designer_editable": False
+ },
+ {
+ "name": "streams_publishes",
+ "value": "{\"add_publisher\":{\"dmaap_info\":{\"topic_url\":\"http://message-router:3904/events/unauthenticated.example-model_Out\"},\"type\":\"message_router\"}}",
+ "description": "standard http port collector will open for listening;",
+ "sourced_at_deployment": False,
+ "policy_editable": False,
+ "designer_editable": False
+ }
+ ],
+ "auxilary": {
+ "helm": {
+ "service": {
+ "type": "ClusterIP",
+ "name": "example-model",
+ "has_internal_only_ports": "true",
+ "ports": [{
+ "name": "http",
+ "port": 8443,
+ "plain_port": 8080,
+ "port_protocol": "http"
+ }
+ ]
+ }
+ },
+ "healthcheck": {"type": "HTTP", "interval": "15s", "timeout": "1s", "port": 8080,
+ "endpoint": "/healthcheck"}},
+ "artifacts": [{"type": "docker image", "uri": "example-model:latest"}],
+ }