diff options
author | shabs2020 <shabnam.sultana@highstreet-technologies.com> | 2021-05-05 13:20:45 +0200 |
---|---|---|
committer | shabs2020 <shabnam.sultana@highstreet-technologies.com> | 2021-05-06 15:18:43 +0200 |
commit | 4a02e289d08e2a9d6203b6e72e2a7c8bd3228070 (patch) | |
tree | de60ac89bb63103eb8034c0844cad8bb3563c126 /adapter/acumos/tests | |
parent | fdbd89ed0c57f370f6ba3e6390f4b523c965fb9c (diff) |
Enable Adapter to work behind proxy
Adapter is now capable of metadata installation during docker image generation both with and without proxy.
Issue-ID: DCAEGEN2-2755
Signed-off-by: shabs2020 <shabnam.sultana@highstreet-technologies.com>
Change-Id: Icc428db4afcf71103828683f3ac3b4b6d22ec1d0
Signed-off-by: shabs2020 <shabnam.sultana@highstreet-technologies.com>
Diffstat (limited to 'adapter/acumos/tests')
-rw-r--r-- | adapter/acumos/tests/test_convert.py | 4 | ||||
-rw-r--r-- | adapter/acumos/tests/test_docker.py | 13 | ||||
-rw-r--r-- | adapter/acumos/tests/test_fed.py | 4 |
3 files changed, 16 insertions, 5 deletions
diff --git a/adapter/acumos/tests/test_convert.py b/adapter/acumos/tests/test_convert.py index 780cc55..bb9e73d 100644 --- a/adapter/acumos/tests/test_convert.py +++ b/adapter/acumos/tests/test_convert.py @@ -3,6 +3,8 @@ # ============================================================================= # 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. # You may obtain a copy of the License at @@ -27,7 +29,7 @@ from testing_helpers import get_fixture_path def test_gen_dcae_artifacts_for_model(monkeypatch): model_repo_path = get_fixture_path('models') model_name = 'example-model' - config = aoconversion.scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword', tmpdir=model_repo_path) + config = aoconversion.scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword', http_proxy='', https_proxy='', no_proxy='', tmpdir=model_repo_path) spec = { "self": { "version": "1.0.0", diff --git a/adapter/acumos/tests/test_docker.py b/adapter/acumos/tests/test_docker.py index 2f618e6..bee53a0 100644 --- a/adapter/acumos/tests/test_docker.py +++ b/adapter/acumos/tests/test_docker.py @@ -3,6 +3,8 @@ # ============================================================================= # 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"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -25,7 +27,7 @@ TEST_META = get_json_fixture("models/example-model/metadata.json") def test_generate_dockerfile(): assert ( - docker_gen._generate_dockerfile(TEST_META, "example-model") + docker_gen._generate_dockerfile(TEST_META, "example-model", '', '', '') == """ FROM python:3.6.8 @@ -35,7 +37,12 @@ def test_generate_dockerfile(): ADD ./example-model /app/example-model ADD ./requirements.txt /app - + ENV http_proxy= + ENV https_proxy= + ENV HTTP_PROXY= + ENV HTTPS_PROXY= + ENV no_proxy= + ENV NO_PROXY= RUN pip install -r /app/requirements.txt && \ pip install acumos_dcae_model_runner @@ -50,6 +57,6 @@ def test_generate_dockerfile(): def test_build_and_push_docker(monkeypatch): model_repo_path = get_fixture_path('models') - config = scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword', tmpdir=model_repo_path) + config = scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword', http_proxy='', https_proxy='', no_proxy='', tmpdir=model_repo_path) monkeypatch.setattr(docker_gen, 'APIClient', test_fed._mockdocker.APIClient) assert(docker_gen.build_and_push_docker(config, 'example-model', model_version="latest") == 'dockerregistry/example-model:latest') diff --git a/adapter/acumos/tests/test_fed.py b/adapter/acumos/tests/test_fed.py index c5400a3..f56e297 100644 --- a/adapter/acumos/tests/test_fed.py +++ b/adapter/acumos/tests/test_fed.py @@ -3,6 +3,8 @@ # ============================================================================= # 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. # You may obtain a copy of the License at @@ -165,7 +167,7 @@ _mockwebdata = { def test_aoconversion(mock_schemas, tmpdir, monkeypatch): - config = aoc_scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword') + config = aoc_scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword', http_proxy='', https_proxy='', no_proxy='') monkeypatch.setattr(aoc_docker_gen, 'APIClient', _mockdocker.APIClient) monkeypatch.setattr(requests, 'get', _mockwww(_mockwebdata)) monkeypatch.setattr(requests, 'post', _mockwww(_mockpostdata)) |