From dd2693b94e4781d1d930a7605b27db43fc2afb7a Mon Sep 17 00:00:00 2001 From: Adriaan de Beer <adriaan@spaceadvisory.com> Date: Wed, 30 Sep 2020 12:47:43 +0000 Subject: [PATCH] ST-456 refactored device_running and tango-commands into single feature, changed Makefile to try to output exit status --- .gitlab-ci.yml | 4 +-- charts/Makefile | 1 + post-deployment/Makefile | 2 +- .../features/device_running.feature | 13 --------- .../features/tango-commands.feature | 4 +-- post-deployment/tests/test_device_running.py | 29 ------------------- post-deployment/tests/test_tango-commands.py | 5 ---- 7 files changed, 6 insertions(+), 52 deletions(-) delete mode 100644 post-deployment/features/device_running.feature delete mode 100644 post-deployment/tests/test_device_running.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf760c4a..607cb7e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -406,9 +406,9 @@ test-chart: artifacts: name: "$CI_PROJECT_NAME-$CI_JOB_ID" paths: - - "charts/build/" + - "build/" reports: - junit: charts/build/report.xml + junit: build/report.xml # push: # stage: push diff --git a/charts/Makefile b/charts/Makefile index 42764a2e..42546428 100644 --- a/charts/Makefile +++ b/charts/Makefile @@ -141,6 +141,7 @@ test: ## test the application on K8s base64 -d | tar -xzf -; \ kubectl --namespace $(KUBE_NAMESPACE) delete pod $(TEST_RUNNER); \ rm ../post-deployment/tango_values.yaml + echo $$status exit $$status show: diff --git a/post-deployment/Makefile b/post-deployment/Makefile index 55d735c3..46a45957 100644 --- a/post-deployment/Makefile +++ b/post-deployment/Makefile @@ -16,7 +16,7 @@ all: test test: install mkdir -p build && \ find . -name "*.pyc" -type f -delete && \ - PYTHONPATH=/app:/app/testing:/app/testing/post-deployment pytest $(if $(findstring all,$(MARK)),, -m $(MARK)) --disable-pytest-warnings | tee pytest.stdout; \ + PYTHONPATH=/app:/app/testing:/app/testing/post-deployment pytest $(if $(findstring all,$(MARK)),, -m $(MARK)) --disable-pytest-warnings | tee pytest.stdout && \ status=$$?; \ $(foreach artfct,$(TEST_ARTIFACTS),mv -f $(artfct) build/;) \ exit $$status diff --git a/post-deployment/features/device_running.feature b/post-deployment/features/device_running.feature deleted file mode 100644 index 13813670..00000000 --- a/post-deployment/features/device_running.feature +++ /dev/null @@ -1,13 +0,0 @@ -# check device is running -# @skip -Feature: Device commands - -Scenario: Test device is running - Given a device called sys/tg_test/1 - When I call the command State() - Then the attribute State is RUNNING - -Scenario: Test DevString command - Given a device called sys/tg_test/1 - When I call the command DevString(Hello World!) - Then the attribute State is Hello World! \ No newline at end of file diff --git a/post-deployment/features/tango-commands.feature b/post-deployment/features/tango-commands.feature index b3217666..9fcb5cb9 100644 --- a/post-deployment/features/tango-commands.feature +++ b/post-deployment/features/tango-commands.feature @@ -22,8 +22,8 @@ Scenario: Test DevString command Scenario: Test short_spectrum_ro quality Given a device called sys/tg_test/1 - Then the attribute short_spectrum_ro is tango._tango.AttrQuality.ATTR_VALID + Then the attribute short_spectrum_ro is ATTR_VALID Scenario: Test short_spectrum quality Given a device called sys/tg_test/1 - Then the attribute short_spectrum is tango._tango.AttrQuality.ATTR_VALID \ No newline at end of file + Then the attribute short_spectrum is ATTR_VALID \ No newline at end of file diff --git a/post-deployment/tests/test_device_running.py b/post-deployment/tests/test_device_running.py deleted file mode 100644 index 9f927a4f..00000000 --- a/post-deployment/tests/test_device_running.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -"""features/device_running.feature feature tests.""" -import tango -from pytest_bdd import given, scenario, then, when, parsers - - -@scenario('device_running.feature', 'Test device is running') -def test_test_device_is_running(): - """Test device is running.""" - - -@given(parsers.parse('a device called {device_name}')) -def device_proxy(run_context, device_name): - """a device called sys/tg_test/1.""" - return tango.DeviceProxy(device_name) - - -@when(parsers.cfparse("I call the command {command_name}({parameter:String?})", extra_types=dict(String=str))) -def call_command(device_proxy, command_name): - """I call the command State().""" - return device_proxy.command_inout(command_name) - - -@then(parsers.parse('the attribute {attribute_name} is {expected_value}')) -def check_attribute(device_proxy, attribute_name, expected_value): - """the attribute State is RUNNING.""" - attr = device_proxy.read_attribute(attribute_name) - assert str(attr.value) == expected_value - diff --git a/post-deployment/tests/test_tango-commands.py b/post-deployment/tests/test_tango-commands.py index 68304c8a..80b0657e 100644 --- a/post-deployment/tests/test_tango-commands.py +++ b/post-deployment/tests/test_tango-commands.py @@ -7,11 +7,6 @@ from tango import Database, DeviceProxy, CmdArgType as ArgType from pytest_bdd import given, scenario, then, when, parsers, scenarios - -# @scenario('tango-cpp.feature', 'Call Command and test attribute') -# def test_call_command_and_test_attribute(): -# """Call Command and test attribute.""" - scenarios('../features/tango-commands.feature') @given(parsers.parse('a device called {device_name}')) -- GitLab