From ebc5791e8f787ffcdc616d5d7d6801edf74141d5 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 13:46:54 -0500 Subject: [PATCH 1/9] Add PATH/NAME vars for most fixture packs In order for pants to detect which changes need to be re-run after changing fixtures, pants needs to be able to infer the relevant dependencies. We could use a super-level target to depend on everything, but then we lose the fine-grained invalidation. The only way to tell pants that a test file is using a particular set of fixtures is via python imports. So, this adds some boilerplate python in every pack dir: __init__.py fixture.py --- contrib/core/__init__.py | 0 contrib/core/fixture.py | 16 ++++++++++++++++ st2tests/st2tests/fixtures/aliases/__init__.py | 0 st2tests/st2tests/fixtures/aliases/fixture.py | 16 ++++++++++++++++ st2tests/st2tests/fixtures/backstop/__init__.py | 0 st2tests/st2tests/fixtures/backstop/fixture.py | 16 ++++++++++++++++ .../st2tests/fixtures/descendants/__init__.py | 0 .../st2tests/fixtures/descendants/fixture.py | 16 ++++++++++++++++ st2tests/st2tests/fixtures/generic/__init__.py | 0 st2tests/st2tests/fixtures/generic/fixture.py | 16 ++++++++++++++++ .../packs/action_chain_tests/__init__.py | 0 .../fixtures/packs/action_chain_tests/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_11/__init__.py | 0 .../fixtures/packs/dummy_pack_11/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_12/__init__.py | 0 .../fixtures/packs/dummy_pack_12/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_13/__init__.py | 0 .../fixtures/packs/dummy_pack_13/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_14/__init__.py | 0 .../fixtures/packs/dummy_pack_14/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_15/__init__.py | 0 .../fixtures/packs/dummy_pack_15/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_16/__init__.py | 0 .../fixtures/packs/dummy_pack_16/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_17/__init__.py | 0 .../fixtures/packs/dummy_pack_17/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_18/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_19/__init__.py | 0 .../fixtures/packs/dummy_pack_19/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_2/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_20/__init__.py | 0 .../fixtures/packs/dummy_pack_20/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_21/__init__.py | 0 .../fixtures/packs/dummy_pack_21/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_22/__init__.py | 0 .../fixtures/packs/dummy_pack_22/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_3/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_4/__init__.py | 0 .../fixtures/packs/dummy_pack_4/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_5/__init__.py | 0 .../fixtures/packs/dummy_pack_5/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_6/__init__.py | 0 .../fixtures/packs/dummy_pack_6/fixture.py | 16 ++++++++++++++++ .../fixtures/packs/dummy_pack_8/__init__.py | 0 .../fixtures/packs/dummy_pack_8/fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../fixtures/packs/orquesta_tests/__init__.py | 0 .../fixtures/packs/orquesta_tests/fixture.py | 16 ++++++++++++++++ .../pack_dir_name_doesnt_match_ref/__init__.py | 0 .../pack_dir_name_doesnt_match_ref/fixture.py | 16 ++++++++++++++++ .../packs/pack_invalid_requirements/__init__.py | 0 .../packs/pack_invalid_requirements/fixture.py | 16 ++++++++++++++++ .../packs/test_library_dependencies/__init__.py | 0 .../packs/test_library_dependencies/fixture.py | 16 ++++++++++++++++ st2tests/st2tests/fixtures/packs_1/__init__.py | 0 .../fixtures/packs_1/dummy_pack_4/__init__.py | 0 .../fixtures/packs_1/dummy_pack_4/fixture.py | 16 ++++++++++++++++ .../st2tests/fixtures/packs_invalid/__init__.py | 0 .../packs_invalid/dummy_pack_17/__init__.py | 0 .../packs_invalid/dummy_pack_17/fixture.py | 16 ++++++++++++++++ .../packs_invalid/dummy_pack_18/__init__.py | 0 .../packs_invalid/dummy_pack_18/fixture.py | 16 ++++++++++++++++ .../fixtures/rule_enforcements/__init__.py | 0 .../fixtures/rule_enforcements/fixture.py | 16 ++++++++++++++++ st2tests/st2tests/fixtures/timers/__init__.py | 0 st2tests/st2tests/fixtures/timers/fixture.py | 16 ++++++++++++++++ st2tests/st2tests/fixtures/traces/__init__.py | 0 st2tests/st2tests/fixtures/traces/fixture.py | 16 ++++++++++++++++ 79 files changed, 640 insertions(+) create mode 100644 contrib/core/__init__.py create mode 100644 contrib/core/fixture.py create mode 100644 st2tests/st2tests/fixtures/aliases/__init__.py create mode 100644 st2tests/st2tests/fixtures/aliases/fixture.py create mode 100644 st2tests/st2tests/fixtures/backstop/__init__.py create mode 100644 st2tests/st2tests/fixtures/backstop/fixture.py create mode 100644 st2tests/st2tests/fixtures/descendants/__init__.py create mode 100644 st2tests/st2tests/fixtures/descendants/fixture.py create mode 100644 st2tests/st2tests/fixtures/generic/__init__.py create mode 100644 st2tests/st2tests/fixtures/generic/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/action_chain_tests/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/action_chain_tests/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_11/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_11/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_12/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_12/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_13/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_13/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_14/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_14/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_15/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_15/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_16/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_17/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_17/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_18/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_19/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_19/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_2/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_20/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_20/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_21/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_21/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_22/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_22/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_3/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_4/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_4/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_5/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_5/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_6/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_6/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_8/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_8/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_properties_1/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_properties_1/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_1/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_1/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_2/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_2/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_3/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_3/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_4/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_4/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_5/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_5/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/orquesta_tests/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/orquesta_tests/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/pack_invalid_requirements/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/pack_invalid_requirements/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/test_library_dependencies/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/test_library_dependencies/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs_1/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs_1/dummy_pack_4/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs_invalid/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py create mode 100644 st2tests/st2tests/fixtures/rule_enforcements/__init__.py create mode 100644 st2tests/st2tests/fixtures/rule_enforcements/fixture.py create mode 100644 st2tests/st2tests/fixtures/timers/__init__.py create mode 100644 st2tests/st2tests/fixtures/timers/fixture.py create mode 100644 st2tests/st2tests/fixtures/traces/__init__.py create mode 100644 st2tests/st2tests/fixtures/traces/fixture.py diff --git a/contrib/core/__init__.py b/contrib/core/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/contrib/core/fixture.py b/contrib/core/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/contrib/core/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/aliases/__init__.py b/st2tests/st2tests/fixtures/aliases/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/aliases/fixture.py b/st2tests/st2tests/fixtures/aliases/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/aliases/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/backstop/__init__.py b/st2tests/st2tests/fixtures/backstop/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/backstop/fixture.py b/st2tests/st2tests/fixtures/backstop/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/backstop/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/descendants/__init__.py b/st2tests/st2tests/fixtures/descendants/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/descendants/fixture.py b/st2tests/st2tests/fixtures/descendants/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/descendants/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/generic/__init__.py b/st2tests/st2tests/fixtures/generic/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/generic/fixture.py b/st2tests/st2tests/fixtures/generic/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/generic/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/action_chain_tests/__init__.py b/st2tests/st2tests/fixtures/packs/action_chain_tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/action_chain_tests/fixture.py b/st2tests/st2tests/fixtures/packs/action_chain_tests/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/action_chain_tests/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_11/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_11/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_11/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_11/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_11/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_12/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_12/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_12/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_12/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_12/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_13/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_13/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_13/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_13/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_13/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_14/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_14/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_14/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_14/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_14/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_15/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_15/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_15/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_15/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_15/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_16/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_16/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_17/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_17/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_17/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_17/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_17/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_18/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_18/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_18/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_19/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_19/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_19/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_19/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_19/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_2/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_2/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_2/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_20/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_20/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_20/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_20/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_20/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_21/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_21/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_21/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_21/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_21/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_22/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_22/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_22/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_22/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_22/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_3/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_3/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_3/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_4/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_4/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_4/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_4/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_4/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_5/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_5/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_5/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_5/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_5/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_6/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_6/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_6/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_6/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_6/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_8/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_8/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_8/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_8/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_8/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_properties_1/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_properties_1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_properties_1/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_properties_1/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_properties_1/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_1/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_1/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_1/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_1/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_2/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_2/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_2/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_2/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_2/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_3/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_3/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_3/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_3/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_3/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_4/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_4/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_4/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_4/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_4/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_5/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_5/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_5/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_5/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_nested_object_5/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/orquesta_tests/__init__.py b/st2tests/st2tests/fixtures/packs/orquesta_tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/orquesta_tests/fixture.py b/st2tests/st2tests/fixtures/packs/orquesta_tests/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/orquesta_tests/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/__init__.py b/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py b/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/pack_invalid_requirements/__init__.py b/st2tests/st2tests/fixtures/packs/pack_invalid_requirements/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/pack_invalid_requirements/fixture.py b/st2tests/st2tests/fixtures/packs/pack_invalid_requirements/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/pack_invalid_requirements/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/test_library_dependencies/__init__.py b/st2tests/st2tests/fixtures/packs/test_library_dependencies/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/test_library_dependencies/fixture.py b/st2tests/st2tests/fixtures/packs/test_library_dependencies/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/test_library_dependencies/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs_1/__init__.py b/st2tests/st2tests/fixtures/packs_1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/__init__.py b/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py b/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py new file mode 100644 index 0000000000..1bc75c937f --- /dev/null +++ b/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2021 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs_invalid/__init__.py b/st2tests/st2tests/fixtures/packs_invalid/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/__init__.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py new file mode 100644 index 0000000000..1bc75c937f --- /dev/null +++ b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2021 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/__init__.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py new file mode 100644 index 0000000000..1bc75c937f --- /dev/null +++ b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2021 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/rule_enforcements/__init__.py b/st2tests/st2tests/fixtures/rule_enforcements/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/rule_enforcements/fixture.py b/st2tests/st2tests/fixtures/rule_enforcements/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/rule_enforcements/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/timers/__init__.py b/st2tests/st2tests/fixtures/timers/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/timers/fixture.py b/st2tests/st2tests/fixtures/timers/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/timers/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/traces/__init__.py b/st2tests/st2tests/fixtures/traces/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/traces/fixture.py b/st2tests/st2tests/fixtures/traces/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/traces/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) From b0e33ae270cebb5caea2e3cf752824eff4c6272d Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 15:14:22 -0500 Subject: [PATCH 2/9] Refactor tests to use PATH/NAME vars from fixture packs --- contrib/core/tests/test_action_sendmail.py | 9 ++- .../tests/unit/test_actionchain.py | 3 +- .../tests/unit/test_actionchain_cancel.py | 11 +-- .../unit/test_actionchain_notifications.py | 13 ++-- .../unit/test_actionchain_pause_resume.py | 11 +-- .../tests/integration/test_localrunner.py | 31 +++++---- .../noop_runner/tests/unit/test_nooprunner.py | 3 +- .../orquesta_runner/tests/unit/test_basic.py | 12 +--- .../orquesta_runner/tests/unit/test_cancel.py | 12 +--- .../tests/unit/test_context.py | 12 +--- .../tests/unit/test_data_flow.py | 12 +--- .../orquesta_runner/tests/unit/test_delay.py | 12 +--- .../tests/unit/test_error_handling.py | 12 +--- .../tests/unit/test_functions_common.py | 12 +--- .../tests/unit/test_functions_task.py | 12 +--- .../tests/unit/test_inquiries.py | 12 +--- .../orquesta_runner/tests/unit/test_notify.py | 12 +--- .../tests/unit/test_output_schema.py | 12 +--- .../tests/unit/test_pause_and_resume.py | 12 +--- .../tests/unit/test_policies.py | 15 ++--- .../orquesta_runner/tests/unit/test_rerun.py | 12 +--- .../tests/unit/test_with_items.py | 12 +--- .../integration/test_pythonrunner_behavior.py | 8 ++- st2actions/tests/unit/policies/test_base.py | 2 +- .../tests/unit/policies/test_concurrency.py | 2 +- .../unit/policies/test_concurrency_by_attr.py | 2 +- .../tests/unit/policies/test_retry_policy.py | 2 +- .../tests/unit/test_actions_registrar.py | 24 ++++--- .../tests/unit/test_execution_cancellation.py | 2 +- st2actions/tests/unit/test_output_schema.py | 5 +- .../test_paramiko_remote_script_runner.py | 2 +- st2actions/tests/unit/test_policies.py | 2 +- st2actions/tests/unit/test_queue_consumers.py | 5 +- .../tests/unit/test_runner_container.py | 3 +- st2actions/tests/unit/test_scheduler.py | 2 +- st2actions/tests/unit/test_worker.py | 3 +- st2actions/tests/unit/test_workflow_engine.py | 12 +--- .../unit/controllers/v1/test_action_alias.py | 6 +- .../controllers/v1/test_alias_execution.py | 3 +- st2api/tests/unit/controllers/v1/test_auth.py | 3 +- .../unit/controllers/v1/test_auth_api_keys.py | 3 +- .../controllers/v1/test_executions_auth.py | 2 +- .../v1/test_executions_descendants.py | 3 +- .../tests/unit/controllers/v1/test_packs.py | 5 +- .../unit/controllers/v1/test_policies.py | 2 +- .../v1/test_rule_enforcement_views.py | 3 +- .../controllers/v1/test_rule_enforcements.py | 3 +- .../unit/controllers/v1/test_rule_views.py | 3 +- .../tests/unit/controllers/v1/test_rules.py | 3 +- .../tests/unit/controllers/v1/test_timers.py | 2 +- .../tests/unit/controllers/v1/test_traces.py | 3 +- .../v1/test_workflow_inspection.py | 11 +-- .../test_register_content_script.py | 9 ++- st2common/tests/unit/services/test_packs.py | 21 +++--- st2common/tests/unit/services/test_policy.py | 3 +- st2common/tests/unit/services/test_trace.py | 3 +- .../test_trace_injection_action_services.py | 3 +- .../tests/unit/services/test_workflow.py | 13 +--- .../services/test_workflow_cancellation.py | 12 +--- .../test_workflow_identify_orphans.py | 12 +--- .../unit/services/test_workflow_rerun.py | 12 +--- .../services/test_workflow_service_retries.py | 12 +--- .../tests/unit/test_action_param_utils.py | 2 +- .../tests/unit/test_actionchain_schema.py | 2 +- st2common/tests/unit/test_config_loader.py | 67 ++++++++++++++----- .../tests/unit/test_configs_registrar.py | 46 ++++++------- st2common/tests/unit/test_content_utils.py | 3 +- st2common/tests/unit/test_executions_util.py | 6 +- ...st_pack_action_alias_unit_testing_utils.py | 12 ++-- st2common/tests/unit/test_param_utils.py | 3 +- st2common/tests/unit/test_policies.py | 2 +- .../tests/unit/test_policies_registrar.py | 13 ++-- st2common/tests/unit/test_purge_executions.py | 3 +- .../tests/unit/test_resource_registrar.py | 50 +++++++++----- st2common/tests/unit/test_runners_utils.py | 3 +- st2common/tests/unit/test_trigger_services.py | 9 +-- st2common/tests/unit/test_virtualenvs.py | 8 ++- .../integration/test_garbage_collector.py | 3 +- st2reactor/tests/unit/test_enforce.py | 2 +- .../tests/unit/test_hash_partitioner.py | 2 +- st2reactor/tests/unit/test_partitioners.py | 2 +- st2reactor/tests/unit/test_rule_matcher.py | 2 +- st2reactor/tests/unit/test_tester.py | 3 +- 83 files changed, 335 insertions(+), 403 deletions(-) diff --git a/contrib/core/tests/test_action_sendmail.py b/contrib/core/tests/test_action_sendmail.py index e6837aa3ba..60b950a876 100644 --- a/contrib/core/tests/test_action_sendmail.py +++ b/contrib/core/tests/test_action_sendmail.py @@ -25,6 +25,7 @@ from st2common.constants import action as action_constants +from st2tests.fixtures.packs.core.fixture import PACK_NAME from st2tests.fixturesloader import FixturesLoader from st2tests.base import RunnerTestCase from st2tests.base import CleanDbTestCase @@ -38,6 +39,10 @@ MOCK_EXECUTION.id = "598dbf0c0640fd54bffc688b" HOSTNAME = socket.gethostname() +# we need the core pack to also be in st2tests.fixtures so we can use FixturesLoader() +# The PACK_NAME import tells pants to include that, so use the var here. +FIXTURE_PACK = "packs/" + PACK_NAME + class SendmailActionTestCase(RunnerTestCase, CleanDbTestCase, CleanFilesTestCase): """ @@ -237,11 +242,11 @@ def _run_action(self, action_parameters): parse the output email data. """ models = self.fixtures_loader.load_models( - fixtures_pack="packs/core", fixtures_dict={"actions": ["sendmail.yaml"]} + fixtures_pack=FIXTURE_PACK, fixtures_dict={"actions": ["sendmail.yaml"]} ) action_db = models["actions"]["sendmail.yaml"] entry_point = self.fixtures_loader.get_fixture_file_path_abs( - "packs/core", "actions", "send_mail/send_mail" + FIXTURE_PACK, "actions", "send_mail/send_mail" ) runner = self._get_runner(action_db, entry_point=entry_point) diff --git a/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py b/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py index 9daed4fa90..964507b191 100644 --- a/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py +++ b/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py @@ -35,6 +35,7 @@ from st2common.util import action_db as action_db_util from st2common.exceptions.action import ParameterRenderingFailedException from st2tests import ExecutionDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader @@ -45,8 +46,6 @@ def __init__(self, status=LIVEACTION_STATUS_SUCCEEDED, result=""): self.result = result -FIXTURES_PACK = "generic" - TEST_MODELS = { "actions": ["a1.yaml", "a2.yaml", "action_4_action_context_param.yaml"], "runners": ["testrunner1.yaml"], diff --git a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_cancel.py b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_cancel.py index dca88cf803..bf6ffdd47a 100644 --- a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_cancel.py +++ b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_cancel.py @@ -35,7 +35,11 @@ from st2common.transport.publishers import CUDPublisher from st2tests import ExecutionDbTestCase -from st2tests import fixturesloader +from st2tests.fixtures.packs.action_chain_tests.fixture import ( + PACK_NAME as TEST_PACK, + PACK_PATH as TEST_PACK_PATH, +) +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH from st2tests.mocks.liveaction import MockLiveActionPublisherNonBlocking from six.moves import range @@ -45,10 +49,7 @@ "actions": ["test_cancel.yaml", "test_cancel_with_subworkflow.yaml"], } -TEST_PACK = "action_chain_tests" -TEST_PACK_PATH = fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK - -PACKS = [TEST_PACK_PATH, fixturesloader.get_fixtures_packs_base_path() + "/core"] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] USERNAME = "stanley" diff --git a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py index d74efa37f2..dfb5a1bf49 100644 --- a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py +++ b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py @@ -35,6 +35,12 @@ from st2common.transport.liveaction import LiveActionPublisher from st2common.transport.publishers import CUDPublisher +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.action_chain_tests.fixture import ( + PACK_NAME as TEST_PACK, + PACK_PATH as TEST_PACK_PATH, +) from st2tests.mocks.liveaction import MockLiveActionPublisherNonBlocking @@ -45,8 +51,6 @@ def __init__(self, status=action_constants.LIVEACTION_STATUS_SUCCEEDED, result=" self.result = result -FIXTURES_PACK = "generic" - TEST_MODELS = {"actions": ["a1.yaml", "a2.yaml"], "runners": ["testrunner1.yaml"]} MODELS = fixturesloader.FixturesLoader().load_models( @@ -60,10 +64,7 @@ def __init__(self, status=action_constants.LIVEACTION_STATUS_SUCCEEDED, result=" FIXTURES_PACK, "actionchains", "chain_with_notifications.yaml" ) -TEST_PACK = "action_chain_tests" -TEST_PACK_PATH = fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK - -PACKS = [TEST_PACK_PATH, fixturesloader.get_fixtures_packs_base_path() + "/core"] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] MOCK_NOTIFY = { "on-complete": { diff --git a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_pause_resume.py b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_pause_resume.py index 46f948d73a..e0dfecc4d6 100644 --- a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_pause_resume.py +++ b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_pause_resume.py @@ -37,7 +37,11 @@ from st2common.util import date as date_utils from st2tests import ExecutionDbTestCase -from st2tests import fixturesloader +from st2tests.fixtures.packs.action_chain_tests.fixture import ( + PACK_NAME as TEST_PACK, + PACK_PATH as TEST_PACK_PATH, +) +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH from st2tests.mocks.liveaction import MockLiveActionPublisherNonBlocking from six.moves import range @@ -67,10 +71,7 @@ ], } -TEST_PACK = "action_chain_tests" -TEST_PACK_PATH = fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK - -PACKS = [TEST_PACK_PATH, fixturesloader.get_fixtures_packs_base_path() + "/core"] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] USERNAME = "stanley" diff --git a/contrib/runners/local_runner/tests/integration/test_localrunner.py b/contrib/runners/local_runner/tests/integration/test_localrunner.py index 4141c5daba..16eb4d9199 100644 --- a/contrib/runners/local_runner/tests/integration/test_localrunner.py +++ b/contrib/runners/local_runner/tests/integration/test_localrunner.py @@ -28,7 +28,6 @@ from st2common.constants import action as action_constants from st2common.persistence.execution import ActionExecutionOutput from st2tests.fixturesloader import FixturesLoader -from st2tests.fixturesloader import get_fixtures_base_path from st2common.util.api import get_full_public_api_url from st2common.util.green import shell from st2common.constants.runners import LOCAL_RUNNER_DEFAULT_ACTION_TIMEOUT @@ -36,6 +35,10 @@ from st2tests.base import CleanDbTestCase from st2tests.base import blocking_eventlet_spawn from st2tests.base import make_mock_stream_readline +from st2tests.fixtures.generic.fixture import ( + PACK_NAME as GENERIC_PACK, + PACK_PATH as GENERIC_PACK_PATH, +) from local_runner import base as local_runner from local_runner.local_shell_command_runner import LocalShellCommandRunner @@ -60,7 +63,7 @@ def setUp(self): def test_shell_command_action_basic(self): models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -94,7 +97,7 @@ def test_shell_command_action_basic(self): def test_timeout(self): models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] # smaller timeout == faster tests. @@ -109,7 +112,7 @@ def test_timeout(self): ) def test_shutdown(self): models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] runner = self._get_runner(action_db, cmd="sleep 0.1") @@ -119,7 +122,7 @@ def test_shutdown(self): def test_common_st2_env_vars_are_available_to_the_action(self): models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -144,7 +147,7 @@ def test_sudo_and_env_variable_preservation(self): # root / non-system user # Note: This test will fail if SETENV option is not present in the sudoers file models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -188,7 +191,7 @@ def test_action_stdout_and_stderr_is_stored_in_the_db(self, mock_spawn, mock_pop ) models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -225,7 +228,7 @@ def test_action_stdout_and_stderr_is_stored_in_the_db_short_running_action( # Verify that we correctly retrieve all the output and wait for stdout and stderr reading # threads for short running actions. models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -298,7 +301,7 @@ def test_action_stdout_and_stderr_is_stored_in_the_db_short_running_action( def test_shell_command_sudo_password_is_passed_to_sudo_binary(self): # Verify that sudo password is correctly passed to sudo binary via stdin models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -356,7 +359,7 @@ def test_shell_command_sudo_password_is_passed_to_sudo_binary(self): def test_shell_command_invalid_stdout_password(self): # Simulate message printed to stderr by sudo when invalid sudo password is provided models = self.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -426,12 +429,12 @@ def setUp(self): def test_script_with_parameters_parameter_serialization(self): models = self.fixtures_loader.load_models( - fixtures_pack="generic", + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local_script_with_params.yaml"]}, ) action_db = models["actions"]["local_script_with_params.yaml"] entry_point = os.path.join( - get_fixtures_base_path(), "generic/actions/local_script_with_params.sh" + GENERIC_PACK_PATH, "actions/local_script_with_params.sh" ) action_parameters = { @@ -557,12 +560,12 @@ def test_action_stdout_and_stderr_is_stored_in_the_db(self, mock_spawn, mock_pop ) models = self.fixtures_loader.load_models( - fixtures_pack="generic", + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local_script_with_params.yaml"]}, ) action_db = models["actions"]["local_script_with_params.yaml"] entry_point = os.path.join( - get_fixtures_base_path(), "generic/actions/local_script_with_params.sh" + GENERIC_PACK_PATH, "actions/local_script_with_params.sh" ) action_parameters = { diff --git a/contrib/runners/noop_runner/tests/unit/test_nooprunner.py b/contrib/runners/noop_runner/tests/unit/test_nooprunner.py index 98c66c33cd..67a234585b 100644 --- a/contrib/runners/noop_runner/tests/unit/test_nooprunner.py +++ b/contrib/runners/noop_runner/tests/unit/test_nooprunner.py @@ -24,6 +24,7 @@ from unittest2 import TestCase from st2common.constants import action as action_constants +from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_PACK from st2tests.fixturesloader import FixturesLoader from noop_runner import noop_runner @@ -34,7 +35,7 @@ class TestNoopRunner(TestCase): def test_noop_command_executes(self): models = TestNoopRunner.fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict={"actions": ["noop.yaml"]} + fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["noop.yaml"]} ) action_db = models["actions"]["noop.yaml"] diff --git a/contrib/runners/orquesta_runner/tests/unit/test_basic.py b/contrib/runners/orquesta_runner/tests/unit/test_basic.py index 5f5c60a012..7c9351423a 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_basic.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_basic.py @@ -48,19 +48,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_cancel.py b/contrib/runners/orquesta_runner/tests/unit/test_cancel.py index 419ff72a0c..cdffd6949d 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_cancel.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_cancel.py @@ -42,19 +42,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_context.py b/contrib/runners/orquesta_runner/tests/unit/test_context.py index bce5a50873..d9e726d9a1 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_context.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_context.py @@ -41,18 +41,12 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_data_flow.py b/contrib/runners/orquesta_runner/tests/unit/test_data_flow.py index dcf06c8923..7679d4e82c 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_data_flow.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_data_flow.py @@ -47,19 +47,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] TEST_1 = "xyz" TEST_2 = "床前明月光 疑是地上霜 舉頭望明月 低頭思故鄉" diff --git a/contrib/runners/orquesta_runner/tests/unit/test_delay.py b/contrib/runners/orquesta_runner/tests/unit/test_delay.py index d2535c8f03..2ac8df69b9 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_delay.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_delay.py @@ -40,19 +40,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_error_handling.py b/contrib/runners/orquesta_runner/tests/unit/test_error_handling.py index 436fe38fea..fb6d38ade1 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_error_handling.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_error_handling.py @@ -43,6 +43,8 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport from st2common.models.db.workflow import WorkflowExecutionDB @@ -50,15 +52,7 @@ from st2common.models.db.execution_queue import ActionExecutionSchedulingQueueItemDB -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] RUNNER_RESULT_FAILED = ( ac_const.LIVEACTION_STATUS_FAILED, diff --git a/contrib/runners/orquesta_runner/tests/unit/test_functions_common.py b/contrib/runners/orquesta_runner/tests/unit/test_functions_common.py index faa92bd03a..4019f9a890 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_functions_common.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_functions_common.py @@ -41,19 +41,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_functions_task.py b/contrib/runners/orquesta_runner/tests/unit/test_functions_task.py index 46ffb861e3..b325839c9d 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_functions_task.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_functions_task.py @@ -40,19 +40,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_inquiries.py b/contrib/runners/orquesta_runner/tests/unit/test_inquiries.py index 8dfdf24a84..f60f9415e8 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_inquiries.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_inquiries.py @@ -42,19 +42,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_notify.py b/contrib/runners/orquesta_runner/tests/unit/test_notify.py index c1e7935de9..ff7114a318 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_notify.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_notify.py @@ -44,19 +44,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import execution as mock_ac_ex_xport from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] MOCK_NOTIFY = { "on-complete": { diff --git a/contrib/runners/orquesta_runner/tests/unit/test_output_schema.py b/contrib/runners/orquesta_runner/tests/unit/test_output_schema.py index f23084b527..fcf685af84 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_output_schema.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_output_schema.py @@ -40,21 +40,15 @@ from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers from st2common.constants import action as ac_const +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport from st2tests.base import RunnerTestCase BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] FAIL_SCHEMA = { "notvalid": { diff --git a/contrib/runners/orquesta_runner/tests/unit/test_pause_and_resume.py b/contrib/runners/orquesta_runner/tests/unit/test_pause_and_resume.py index 984887b907..7473d9db8e 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_pause_and_resume.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_pause_and_resume.py @@ -43,19 +43,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/contrib/runners/orquesta_runner/tests/unit/test_policies.py b/contrib/runners/orquesta_runner/tests/unit/test_policies.py index c8b836c53d..641a9d7823 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_policies.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_policies.py @@ -44,19 +44,16 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import ( + PACK_NAME as TEST_PACK, + PACK_PATH as TEST_PACK_PATH, +) from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] RUNNER_RESULT_FAILED = (ac_const.LIVEACTION_STATUS_FAILED, {"stderror": "..."}, {}) diff --git a/contrib/runners/orquesta_runner/tests/unit/test_rerun.py b/contrib/runners/orquesta_runner/tests/unit/test_rerun.py index ca972f2d2d..420b909e27 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_rerun.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_rerun.py @@ -37,19 +37,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] RUNNER_RESULT_FAILED = ( action_constants.LIVEACTION_STATUS_FAILED, diff --git a/contrib/runners/orquesta_runner/tests/unit/test_with_items.py b/contrib/runners/orquesta_runner/tests/unit/test_with_items.py index 6e16b7255d..8e8b67bd94 100644 --- a/contrib/runners/orquesta_runner/tests/unit/test_with_items.py +++ b/contrib/runners/orquesta_runner/tests/unit/test_with_items.py @@ -46,19 +46,13 @@ from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers from st2common.util import action_db as action_utils +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] RUNNER_RESULT_RUNNING = ( action_constants.LIVEACTION_STATUS_RUNNING, diff --git a/contrib/runners/python_runner/tests/integration/test_pythonrunner_behavior.py b/contrib/runners/python_runner/tests/integration/test_pythonrunner_behavior.py index 38441933b2..a749ef93b8 100644 --- a/contrib/runners/python_runner/tests/integration/test_pythonrunner_behavior.py +++ b/contrib/runners/python_runner/tests/integration/test_pythonrunner_behavior.py @@ -32,10 +32,14 @@ from st2tests import config from st2tests.base import CleanFilesTestCase from st2tests.base import CleanDbTestCase +from st2tests.fixtures.packs.test_library_dependencies.fixture import ( + PACK_NAME as TEST_LIBRARY_DEPENDENCIES, +) from st2tests.fixturesloader import get_fixtures_base_path __all__ = ["PythonRunnerBehaviorTestCase"] +FIXTURES_BASE_PATH = get_fixtures_base_path() BASE_DIR = os.path.dirname(os.path.abspath(__file__)) WRAPPER_SCRIPT_PATH = os.path.join( BASE_DIR, "../../../python_runner/python_runner/python_action_wrapper.py" @@ -72,7 +76,7 @@ def test_priority_of_loading_library_after_setup_pack_virtualenv(self): To test above, this uses 'get_library_path.py' action in 'test_library_dependencies' pack. This action returns file-path of imported module which is specified by 'module' parameter. """ - pack_name = "test_library_dependencies" + pack_name = TEST_LIBRARY_DEPENDENCIES # Before calling action, this sets up virtualenv for test pack. This pack has # requirements.txt wihch only writes 'six' module. @@ -123,7 +127,7 @@ def _run_action(self, pack, action, params, runner_params={}): setattr(runner, key, value) runner.entry_point = os.path.join( - get_fixtures_base_path(), "packs/%s/actions/%s" % (pack, action) + FIXTURES_BASE_PATH, f"packs/{pack}/actions/{action}" ) runner.pre_run() return runner.run(params) diff --git a/st2actions/tests/unit/policies/test_base.py b/st2actions/tests/unit/policies/test_base.py index 2e5003d89c..fb475fbf66 100644 --- a/st2actions/tests/unit/policies/test_base.py +++ b/st2actions/tests/unit/policies/test_base.py @@ -30,13 +30,13 @@ from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests.base import DbTestCase from st2tests.base import CleanDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["SchedulerPoliciesTestCase", "NotifierPoliciesTestCase"] -PACK = "generic" TEST_FIXTURES_1 = { "actions": ["action1.yaml"], "policies": [ diff --git a/st2actions/tests/unit/policies/test_concurrency.py b/st2actions/tests/unit/policies/test_concurrency.py index 647a4f074d..1be4b86da3 100644 --- a/st2actions/tests/unit/policies/test_concurrency.py +++ b/st2actions/tests/unit/policies/test_concurrency.py @@ -41,6 +41,7 @@ from st2tests import DbTestCase, EventletTestCase from st2tests import ExecutionDbTestCase import st2tests.config as tests_config +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.execution import MockExecutionPublisher from st2tests.mocks.liveaction import MockLiveActionPublisherSchedulingQueueOnly @@ -49,7 +50,6 @@ __all__ = ["ConcurrencyPolicyTestCase"] -PACK = "generic" TEST_FIXTURES = { "actions": ["action1.yaml", "action2.yaml"], "policies": ["policy_1.yaml", "policy_5.yaml"], diff --git a/st2actions/tests/unit/policies/test_concurrency_by_attr.py b/st2actions/tests/unit/policies/test_concurrency_by_attr.py index 21c254a1a6..937a4149ef 100644 --- a/st2actions/tests/unit/policies/test_concurrency_by_attr.py +++ b/st2actions/tests/unit/policies/test_concurrency_by_attr.py @@ -38,6 +38,7 @@ from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests import ExecutionDbTestCase, EventletTestCase import st2tests.config as tests_config +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.execution import MockExecutionPublisher from st2tests.mocks.liveaction import MockLiveActionPublisherSchedulingQueueOnly @@ -46,7 +47,6 @@ __all__ = ["ConcurrencyByAttributePolicyTestCase"] -PACK = "generic" TEST_FIXTURES = { "actions": ["action1.yaml", "action2.yaml"], "policies": ["policy_3.yaml", "policy_7.yaml"], diff --git a/st2actions/tests/unit/policies/test_retry_policy.py b/st2actions/tests/unit/policies/test_retry_policy.py index 21371c6a02..8e16a7029c 100644 --- a/st2actions/tests/unit/policies/test_retry_policy.py +++ b/st2actions/tests/unit/policies/test_retry_policy.py @@ -33,11 +33,11 @@ from st2actions.policies.retry import ExecutionRetryPolicyApplicator from st2tests.base import DbTestCase from st2tests.base import CleanDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["RetryPolicyTestCase"] -PACK = "generic" TEST_FIXTURES = {"actions": ["action1.yaml"], "policies": ["policy_4.yaml"]} diff --git a/st2actions/tests/unit/test_actions_registrar.py b/st2actions/tests/unit/test_actions_registrar.py index d01b83a05f..1426d4503a 100644 --- a/st2actions/tests/unit/test_actions_registrar.py +++ b/st2actions/tests/unit/test_actions_registrar.py @@ -15,8 +15,6 @@ from __future__ import absolute_import -import os - import six import jsonschema import mock @@ -28,6 +26,10 @@ from st2common.models.db.runner import RunnerTypeDB import st2tests.base as tests_base +from st2tests.fixtures.generic.fixture import ( + PACK_NAME as GENERIC_PACK, + PACK_PATH as GENERIC_PACK_PATH, +) import st2tests.fixturesloader as fixtures_loader from st2tests.fixturesloader import get_fixtures_base_path @@ -38,7 +40,7 @@ # base paths directory. This will never happen outside the context of test fixtures. @mock.patch( "st2common.content.utils.get_pack_base_path", - mock.Mock(return_value=os.path.join(get_fixtures_base_path(), "generic")), + mock.Mock(return_value=GENERIC_PACK_PATH), ) class ActionsRegistrarTest(tests_base.DbTestCase): @mock.patch.object( @@ -85,7 +87,7 @@ def test_pack_name_missing(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - "generic", "actions", "action_3_pack_missing.yaml" + GENERIC_PACK, "actions", "action_3_pack_missing.yaml" ) registrar._register_action("dummy", action_file) action_name = None @@ -109,7 +111,7 @@ def test_register_action_with_no_params(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - "generic", "actions", "action-with-no-parameters.yaml" + GENERIC_PACK, "actions", "action-with-no-parameters.yaml" ) self.assertEqual(registrar._register_action("dummy", action_file), False) @@ -126,7 +128,7 @@ def test_register_action_invalid_parameter_type_attribute(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - "generic", "actions", "action_invalid_param_type.yaml" + GENERIC_PACK, "actions", "action_invalid_param_type.yaml" ) expected_msg = "'list' is not valid under any of the given schema" @@ -150,7 +152,7 @@ def test_register_action_invalid_parameter_name(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - "generic", "actions", "action_invalid_parameter_name.yaml" + GENERIC_PACK, "actions", "action_invalid_parameter_name.yaml" ) expected_msg = ( @@ -161,7 +163,7 @@ def test_register_action_invalid_parameter_name(self): jsonschema.ValidationError, expected_msg, registrar._register_action, - "generic", + GENERIC_PACK, action_file, ) @@ -177,10 +179,10 @@ def test_invalid_params_schema(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - "generic", "actions", "action-invalid-schema-params.yaml" + GENERIC_PACK, "actions", "action-invalid-schema-params.yaml" ) try: - registrar._register_action("generic", action_file) + registrar._register_action(GENERIC_PACK, action_file) self.fail("Invalid action schema. Should have failed.") except jsonschema.ValidationError: pass @@ -197,7 +199,7 @@ def test_action_update(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - "generic", "actions", "action1.yaml" + GENERIC_PACK, "actions", "action1.yaml" ) registrar._register_action("wolfpack", action_file) # try registering again. this should not throw errors. diff --git a/st2actions/tests/unit/test_execution_cancellation.py b/st2actions/tests/unit/test_execution_cancellation.py index c4c535aaa9..96eacc1a89 100644 --- a/st2actions/tests/unit/test_execution_cancellation.py +++ b/st2actions/tests/unit/test_execution_cancellation.py @@ -37,6 +37,7 @@ from st2common.transport.liveaction import LiveActionPublisher from st2common.transport.publishers import CUDPublisher from st2tests import ExecutionDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.execution import MockExecutionPublisher from st2tests.mocks.liveaction import MockLiveActionPublisher @@ -47,7 +48,6 @@ TEST_FIXTURES = {"actions": ["action1.yaml"]} -PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2actions/tests/unit/test_output_schema.py b/st2actions/tests/unit/test_output_schema.py index 8a91e9cb4d..a66f9ffb12 100644 --- a/st2actions/tests/unit/test_output_schema.py +++ b/st2actions/tests/unit/test_output_schema.py @@ -38,11 +38,14 @@ from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.fixtures.packs.dummy_pack_1.fixture import PACK_PATH as DUMMY_PACK_1_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import ( + PACK_PATH as ORQUESTA_TESTS_PACK_PATH, +) PACKS = [ DUMMY_PACK_1_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/orquesta_tests", + ORQUESTA_TESTS_PACK_PATH, ] MOCK_PYTHON_ACTION_RESULT = { diff --git a/st2actions/tests/unit/test_paramiko_remote_script_runner.py b/st2actions/tests/unit/test_paramiko_remote_script_runner.py index 1bf67a9503..4f09170781 100644 --- a/st2actions/tests/unit/test_paramiko_remote_script_runner.py +++ b/st2actions/tests/unit/test_paramiko_remote_script_runner.py @@ -34,11 +34,11 @@ from remote_runner.remote_script_runner import ParamikoRemoteScriptRunner +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["ParamikoScriptRunnerTestCase"] -FIXTURES_PACK = "generic" TEST_MODELS = {"actions": ["a1.yaml"]} MODELS = FixturesLoader().load_models( diff --git a/st2actions/tests/unit/test_policies.py b/st2actions/tests/unit/test_policies.py index f16ffbcb0b..a2c828b39b 100644 --- a/st2actions/tests/unit/test_policies.py +++ b/st2actions/tests/unit/test_policies.py @@ -28,6 +28,7 @@ from st2common.transport.publishers import CUDPublisher from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests import ExecutionDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.runners import runner from st2tests.mocks.execution import MockExecutionPublisher @@ -42,7 +43,6 @@ "policies": ["policy_1.yaml", "policy_2.yaml"], } -PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2actions/tests/unit/test_queue_consumers.py b/st2actions/tests/unit/test_queue_consumers.py index 80d3a09c26..0ddfaea164 100644 --- a/st2actions/tests/unit/test_queue_consumers.py +++ b/st2actions/tests/unit/test_queue_consumers.py @@ -15,8 +15,6 @@ from __future__ import absolute_import -import st2tests - import st2tests.config as tests_config tests_config.parse_args() @@ -38,9 +36,10 @@ from st2common.util import action_db as action_utils from st2common.util import date as date_utils from st2tests.base import ExecutionDbTestCase +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH -PACKS = [st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core"] +PACKS = [CORE_PACK_PATH] @mock.patch.object(PoolPublisher, "publish", mock.MagicMock()) diff --git a/st2actions/tests/unit/test_runner_container.py b/st2actions/tests/unit/test_runner_container.py index f17eeceb71..0dcb299fde 100644 --- a/st2actions/tests/unit/test_runner_container.py +++ b/st2actions/tests/unit/test_runner_container.py @@ -39,6 +39,7 @@ import st2tests.config as tests_config tests_config.parse_args() +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader @@ -64,8 +65,6 @@ ], } -FIXTURES_PACK = "generic" - NON_UTF8_RESULT = { "stderr": "", "stdout": "\x82\n", diff --git a/st2actions/tests/unit/test_scheduler.py b/st2actions/tests/unit/test_scheduler.py index 1a2d63bc1c..7556c7b036 100644 --- a/st2actions/tests/unit/test_scheduler.py +++ b/st2actions/tests/unit/test_scheduler.py @@ -25,6 +25,7 @@ import st2common from st2tests import ExecutionDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.liveaction import MockLiveActionPublisherSchedulingQueueOnly @@ -53,7 +54,6 @@ "status": "requested", } -PACK = "generic" TEST_FIXTURES = { "actions": ["action1.yaml", "action2.yaml"], "policies": ["policy_3.yaml", "policy_7.yaml"], diff --git a/st2actions/tests/unit/test_worker.py b/st2actions/tests/unit/test_worker.py index 0cf4d730f7..ca2bf172dc 100644 --- a/st2actions/tests/unit/test_worker.py +++ b/st2actions/tests/unit/test_worker.py @@ -34,6 +34,7 @@ from local_runner.local_shell_command_runner import LocalShellCommandRunner from st2tests.base import DbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader import st2tests.config as tests_config from six.moves import range @@ -42,8 +43,6 @@ TEST_FIXTURES = {"actions": ["local.yaml"]} -FIXTURES_PACK = "generic" - NON_UTF8_RESULT = { "stderr": "", "stdout": "\x82\n", diff --git a/st2actions/tests/unit/test_workflow_engine.py b/st2actions/tests/unit/test_workflow_engine.py index a2090a2530..e4729798fe 100644 --- a/st2actions/tests/unit/test_workflow_engine.py +++ b/st2actions/tests/unit/test_workflow_engine.py @@ -43,19 +43,13 @@ from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers from st2reactor.garbage_collector import base as garbage_collector +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/st2api/tests/unit/controllers/v1/test_action_alias.py b/st2api/tests/unit/controllers/v1/test_action_alias.py index 208ed082be..bf31469c57 100644 --- a/st2api/tests/unit/controllers/v1/test_action_alias.py +++ b/st2api/tests/unit/controllers/v1/test_action_alias.py @@ -16,13 +16,13 @@ from st2common.models.api.action import ActionAliasAPI from st2api.controllers.v1.actionalias import ActionAliasController +from st2tests.fixtures.aliases.fixture import PACK_NAME as FIXTURES_PACK +from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest from st2tests.api import APIControllerWithIncludeAndExcludeFilterTestCase -FIXTURES_PACK = "aliases" - TEST_MODELS = { "aliases": [ "alias1.yaml", @@ -36,8 +36,6 @@ "aliases": ["alias3.yaml"], } -GENERIC_FIXTURES_PACK = "generic" - TEST_LOAD_MODELS_GENERIC = {"aliases": ["alias3.yaml"], "runners": ["testrunner1.yaml"]} diff --git a/st2api/tests/unit/controllers/v1/test_alias_execution.py b/st2api/tests/unit/controllers/v1/test_alias_execution.py index 4b3fa51e26..44261fde3f 100644 --- a/st2api/tests/unit/controllers/v1/test_alias_execution.py +++ b/st2api/tests/unit/controllers/v1/test_alias_execution.py @@ -21,11 +21,10 @@ from st2common.models.db.execution import ActionExecutionDB from st2common.services import action as action_service from st2tests.api import SUPER_SECRET_PARAMETER +from st2tests.fixtures.aliases.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest -FIXTURES_PACK = "aliases" - TEST_MODELS = { "aliases": [ "alias1.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_auth.py b/st2api/tests/unit/controllers/v1/test_auth.py index 7fad0d816f..a5a5aec0de 100644 --- a/st2api/tests/unit/controllers/v1/test_auth.py +++ b/st2api/tests/unit/controllers/v1/test_auth.py @@ -25,6 +25,7 @@ from st2common.models.db.auth import ApiKeyDB, TokenDB, UserDB from st2common.persistence.auth import ApiKey, Token, User from st2common.exceptions.auth import TokenNotFoundError +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader OBJ_ID = bson.ObjectId() @@ -173,8 +174,6 @@ def test_token_not_provided(self): self.assertEqual(response.status_int, 401) -FIXTURES_PACK = "generic" - TEST_MODELS = {"apikeys": ["apikey1.yaml", "apikey_disabled.yaml"]} # Hardcoded keys matching the fixtures. Lazy way to workaround one-way hash and still use fixtures. diff --git a/st2api/tests/unit/controllers/v1/test_auth_api_keys.py b/st2api/tests/unit/controllers/v1/test_auth_api_keys.py index 763008557f..ad2e0e5bc4 100644 --- a/st2api/tests/unit/controllers/v1/test_auth_api_keys.py +++ b/st2api/tests/unit/controllers/v1/test_auth_api_keys.py @@ -19,11 +19,10 @@ from six.moves import http_client from st2common.constants.secrets import MASKED_ATTRIBUTE_VALUE from st2common.persistence.auth import ApiKey +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest -FIXTURES_PACK = "generic" - TEST_MODELS = { "apikeys": [ "apikey1.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_executions_auth.py b/st2api/tests/unit/controllers/v1/test_executions_auth.py index 04392b319c..8ffe5ac3eb 100644 --- a/st2api/tests/unit/controllers/v1/test_executions_auth.py +++ b/st2api/tests/unit/controllers/v1/test_executions_auth.py @@ -44,6 +44,7 @@ from st2common.util import crypto as crypto_utils from st2common.util import date as date_utils from st2tests.api import SUPER_SECRET_PARAMETER +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -106,7 +107,6 @@ id=bson.ObjectId(), user="tokenuser", token=uuid.uuid4().hex, expiry=EXPIRY ) -FIXTURES_PACK = "generic" FIXTURES = {"users": ["system_user.yaml", "token_user.yaml"]} # These parameters are used for the tests of getting value from datastore and decrypting it at diff --git a/st2api/tests/unit/controllers/v1/test_executions_descendants.py b/st2api/tests/unit/controllers/v1/test_executions_descendants.py index 945e03feeb..55b1c12f53 100644 --- a/st2api/tests/unit/controllers/v1/test_executions_descendants.py +++ b/st2api/tests/unit/controllers/v1/test_executions_descendants.py @@ -15,12 +15,11 @@ import six +from st2tests.fixtures.descendants.fixture import PACK_NAME as DESCENDANTS_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest -DESCENDANTS_PACK = "descendants" - DESCENDANTS_FIXTURES = { "executions": [ "root_execution.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_packs.py b/st2api/tests/unit/controllers/v1/test_packs.py index 7de148d9f1..5b89d67361 100644 --- a/st2api/tests/unit/controllers/v1/test_packs.py +++ b/st2api/tests/unit/controllers/v1/test_packs.py @@ -38,6 +38,9 @@ PACK_NAME as DUMMY_PACK_10, PACK_PATH as DUMMY_PACK_10_PATH, ) +from st2tests.fixtures.packs.dummy_pack_15.fixture import ( + PACK_NAME as DUMMY_PACK_15, +) __all__ = ["PacksControllerTestCase"] @@ -669,7 +672,7 @@ def test_packs_register_endpoint(self, mock_get_packs): # Fail on failure (broken action metadata) resp = self.app.post_json( - "/v1/packs/register", {"packs": ["dummy_pack_15"]}, expect_errors=True + "/v1/packs/register", {"packs": [DUMMY_PACK_15]}, expect_errors=True ) expected_msg = "Failed to register action" diff --git a/st2api/tests/unit/controllers/v1/test_policies.py b/st2api/tests/unit/controllers/v1/test_policies.py index 3127b3aeb7..c68cb31bbc 100644 --- a/st2api/tests/unit/controllers/v1/test_policies.py +++ b/st2api/tests/unit/controllers/v1/test_policies.py @@ -22,6 +22,7 @@ from st2common.transport.publishers import PoolPublisher from st2api.controllers.v1.policies import PolicyTypeController from st2api.controllers.v1.policies import PolicyController +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -35,7 +36,6 @@ "policies": ["policy_1.yaml", "policy_2.yaml"], } -PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py b/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py index 0a7a104d35..29459effe3 100644 --- a/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py +++ b/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py @@ -16,6 +16,7 @@ import six from st2api.controllers.v1.rule_enforcement_views import RuleEnforcementViewController +from st2tests.fixtures.rule_enforcements.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -31,8 +32,6 @@ "triggerinstances": ["trigger_instance_1.yaml"], } -FIXTURES_PACK = "rule_enforcements" - class RuleEnforcementViewsControllerTestCase( FunctionalTest, APIControllerWithIncludeAndExcludeFilterTestCase diff --git a/st2api/tests/unit/controllers/v1/test_rule_enforcements.py b/st2api/tests/unit/controllers/v1/test_rule_enforcements.py index f2de1e2b2a..5a5988ae7c 100644 --- a/st2api/tests/unit/controllers/v1/test_rule_enforcements.py +++ b/st2api/tests/unit/controllers/v1/test_rule_enforcements.py @@ -16,6 +16,7 @@ import six from st2api.controllers.v1.rule_enforcements import RuleEnforcementController +from st2tests.fixtures.rule_enforcements.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -27,8 +28,6 @@ "enforcements": ["enforcement1.yaml", "enforcement2.yaml", "enforcement3.yaml"] } -FIXTURES_PACK = "rule_enforcements" - class RuleEnforcementControllerTestCase( FunctionalTest, APIControllerWithIncludeAndExcludeFilterTestCase diff --git a/st2api/tests/unit/controllers/v1/test_rule_views.py b/st2api/tests/unit/controllers/v1/test_rule_views.py index cafc1b7cf2..f3b29fcc7f 100644 --- a/st2api/tests/unit/controllers/v1/test_rule_views.py +++ b/st2api/tests/unit/controllers/v1/test_rule_views.py @@ -22,6 +22,7 @@ from st2common.models.system.common import ResourceReference from st2api.controllers.v1.rule_views import RuleViewController +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -38,8 +39,6 @@ TEST_FIXTURES_RULES = {"rules": ["rule1.yaml", "rule4.yaml", "rule5.yaml"]} -FIXTURES_PACK = "generic" - class RuleViewControllerTestCase( FunctionalTest, APIControllerWithIncludeAndExcludeFilterTestCase diff --git a/st2api/tests/unit/controllers/v1/test_rules.py b/st2api/tests/unit/controllers/v1/test_rules.py index daf6845bcb..d3e30c1c4a 100644 --- a/st2api/tests/unit/controllers/v1/test_rules.py +++ b/st2api/tests/unit/controllers/v1/test_rules.py @@ -26,6 +26,7 @@ from st2common.models.system.common import ResourceReference from st2common.transport.publishers import PoolPublisher from st2api.controllers.v1.rules import RuleController +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -40,8 +41,6 @@ "triggertypes": ["triggertype1.yaml", "triggertype_with_parameters_2.yaml"], } -FIXTURES_PACK = "generic" - @mock.patch.object(PoolPublisher, "publish", mock.MagicMock()) class RulesControllerTestCase( diff --git a/st2api/tests/unit/controllers/v1/test_timers.py b/st2api/tests/unit/controllers/v1/test_timers.py index cb57844539..fdf32e5b2f 100644 --- a/st2api/tests/unit/controllers/v1/test_timers.py +++ b/st2api/tests/unit/controllers/v1/test_timers.py @@ -22,6 +22,7 @@ from st2common.models.system.common import ResourceReference from st2tests.base import DbTestCase +from st2tests.fixtures.timers.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2common.constants.triggers import ( INTERVAL_TIMER_TRIGGER_REF, @@ -31,7 +32,6 @@ from st2tests.api import FunctionalTest -PACK = "timers" FIXTURES = { "triggers": [ "cron1.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_traces.py b/st2api/tests/unit/controllers/v1/test_traces.py index 9322a6b782..01e630dc2b 100644 --- a/st2api/tests/unit/controllers/v1/test_traces.py +++ b/st2api/tests/unit/controllers/v1/test_traces.py @@ -19,13 +19,12 @@ monkey_patch() from st2api.controllers.v1.traces import TracesController +from st2tests.fixtures.traces.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest from st2tests.api import APIControllerWithIncludeAndExcludeFilterTestCase -FIXTURES_PACK = "traces" - TEST_MODELS = { "traces": [ "trace_empty.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_workflow_inspection.py b/st2api/tests/unit/controllers/v1/test_workflow_inspection.py index 91e251fe9d..3dc36acb01 100644 --- a/st2api/tests/unit/controllers/v1/test_workflow_inspection.py +++ b/st2api/tests/unit/controllers/v1/test_workflow_inspection.py @@ -20,16 +20,11 @@ import st2tests from st2tests.api import FunctionalTest +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] class WorkflowInspectionControllerTest(FunctionalTest, st2tests.WorkflowTestCase): diff --git a/st2common/tests/integration/test_register_content_script.py b/st2common/tests/integration/test_register_content_script.py index 8ec089c8eb..212b0b7b99 100644 --- a/st2common/tests/integration/test_register_content_script.py +++ b/st2common/tests/integration/test_register_content_script.py @@ -23,7 +23,11 @@ from st2common.util.shell import run_command from st2tests import config as test_config from st2tests.fixturesloader import get_fixtures_packs_base_path + +# import this so that pants can infer dependencies for the glob below from st2tests.fixtures.packs.dummy_pack_1.fixture import PACK_PATH as DUMMY_PACK_1_PATH +from st2tests.fixtures.packs.dummy_pack_4.fixture import PACK_PATH as DUMMY_PACK_4_PATH +from st2tests.fixtures.packs_1.dummy_pack_4.fixture import PACK_PATH as EMPTY_PACK_PATH BASE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -83,7 +87,7 @@ def test_register_from_pack_fail_on_failure_pack_dir_doesnt_exist(self): def test_register_from_pack_action_metadata_fails_validation(self): # No fail on failure flag, should succeed - pack_dir = os.path.join(get_fixtures_packs_base_path(), "dummy_pack_4") + pack_dir = DUMMY_PACK_4_PATH runner_dirs = os.path.join(get_fixtures_packs_base_path(), "runners") opts = [ @@ -98,7 +102,7 @@ def test_register_from_pack_action_metadata_fails_validation(self): self.assertEqual(exit_code, 0) # Fail on failure, should fail - pack_dir = os.path.join(get_fixtures_packs_base_path(), "dummy_pack_4") + pack_dir = DUMMY_PACK_4_PATH opts = [ "--register-pack=%s" % (pack_dir), "--register-fail-on-failure", @@ -113,6 +117,7 @@ def test_register_from_packs_doesnt_throw_on_missing_pack_resource_folder(self): # dummy_pack_4 only has actions folder, make sure it doesn't throw when # sensors and other resource folders are missing + self.assertIn("fixtures/packs_1/", EMPTY_PACK_PATH) # Note: We want to use a different config which sets fixtures/packs_1/ # dir as packs_base_paths cmd = [ diff --git a/st2common/tests/unit/services/test_packs.py b/st2common/tests/unit/services/test_packs.py index 07d08ff7da..c2cb98a8eb 100644 --- a/st2common/tests/unit/services/test_packs.py +++ b/st2common/tests/unit/services/test_packs.py @@ -33,18 +33,17 @@ from st2common.services.packs import restore_temp_action_files from st2common.services.packs import remove_temp_action_files -TEST_PACK = "dummy_pack_1" -TEST_PACK_PATH = os.path.join( - st2tests.fixturesloader.get_fixtures_packs_base_path(), TEST_PACK +from st2tests.fixtures.packs.core.fixture import PACK_NAME as TEST_SOURCE_PACK +from st2tests.fixtures.packs.dummy_pack_1.fixture import ( + PACK_NAME as TEST_PACK, + PACK_PATH as TEST_PACK_PATH, ) - -TEST_SOURCE_PACK = "core" - -TEST_SOURCE_WORKFLOW_PACK = "orquesta_tests" - -TEST_DEST_PACK = "dummy_pack_23" -TEST_DEST_PACK_PATH = os.path.join( - st2tests.fixturesloader.get_fixtures_packs_base_path(), TEST_DEST_PACK +from st2tests.fixtures.packs.dummy_pack_23.fixture import ( + PACK_NAME as TEST_DEST_PACK, + PACK_PATH as TEST_DEST_PACK_PATH, +) +from st2tests.fixtures.packs.orquesta_tests.fixture import ( + PACK_NAME as TEST_SOURCE_WORKFLOW_PACK, ) SOURCE_ACTION_WITH_PYTHON_SCRIPT_RUNNER = { diff --git a/st2common/tests/unit/services/test_policy.py b/st2common/tests/unit/services/test_policy.py index 128ce1defe..a590322452 100644 --- a/st2common/tests/unit/services/test_policy.py +++ b/st2common/tests/unit/services/test_policy.py @@ -30,11 +30,10 @@ from st2common.services import policies as policy_service import st2tests +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests import fixturesloader as fixtures -PACK = "generic" - TEST_FIXTURES = { "actions": [ "action1.yaml", # wolfpack.action-1 diff --git a/st2common/tests/unit/services/test_trace.py b/st2common/tests/unit/services/test_trace.py index 807dc4251d..39db4c7ade 100644 --- a/st2common/tests/unit/services/test_trace.py +++ b/st2common/tests/unit/services/test_trace.py @@ -26,12 +26,11 @@ from st2common.models.api.trace import TraceContext from st2common.persistence.trace import Trace from st2common.services import trace as trace_service +from st2tests.fixtures.traces.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests import DbTestCase -FIXTURES_PACK = "traces" - TEST_MODELS = OrderedDict( ( ( diff --git a/st2common/tests/unit/services/test_trace_injection_action_services.py b/st2common/tests/unit/services/test_trace_injection_action_services.py index 4b4fe0d177..716aed61ec 100644 --- a/st2common/tests/unit/services/test_trace_injection_action_services.py +++ b/st2common/tests/unit/services/test_trace_injection_action_services.py @@ -18,11 +18,10 @@ from st2common.persistence.liveaction import LiveAction from st2common.persistence.trace import Trace import st2common.services.action as action_services +from st2tests.fixtures.traces.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests import DbTestCase -FIXTURES_PACK = "traces" - TEST_MODELS = { "executions": ["traceable_execution.yaml"], "liveactions": ["traceable_liveaction.yaml"], diff --git a/st2common/tests/unit/services/test_workflow.py b/st2common/tests/unit/services/test_workflow.py index 23bd4aca60..11b082f092 100644 --- a/st2common/tests/unit/services/test_workflow.py +++ b/st2common/tests/unit/services/test_workflow.py @@ -41,22 +41,15 @@ from st2common.services import workflows as workflow_service from st2common.transport import liveaction as lv_ac_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - PACK_7 = "dummy_pack_7" PACK_7_PATH = st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + PACK_7 -PACKS = [ - TEST_PACK_PATH, - PACK_7_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, PACK_7_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/st2common/tests/unit/services/test_workflow_cancellation.py b/st2common/tests/unit/services/test_workflow_cancellation.py index 22694924a3..d8b7b2206f 100644 --- a/st2common/tests/unit/services/test_workflow_cancellation.py +++ b/st2common/tests/unit/services/test_workflow_cancellation.py @@ -32,6 +32,8 @@ from st2common.services import workflows as wf_svc from st2common.transport import liveaction as lv_ac_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport @@ -40,15 +42,7 @@ "actions": ["sequential.yaml", "join.yaml"], } -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/st2common/tests/unit/services/test_workflow_identify_orphans.py b/st2common/tests/unit/services/test_workflow_identify_orphans.py index 306e22badd..7110b509c9 100644 --- a/st2common/tests/unit/services/test_workflow_identify_orphans.py +++ b/st2common/tests/unit/services/test_workflow_identify_orphans.py @@ -43,21 +43,15 @@ from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers from st2common.util import date as date_utils +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport LOG = logging.getLogger(__name__) -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] @mock.patch.object( diff --git a/st2common/tests/unit/services/test_workflow_rerun.py b/st2common/tests/unit/services/test_workflow_rerun.py index f5ff2bc487..1fb10ace6f 100644 --- a/st2common/tests/unit/services/test_workflow_rerun.py +++ b/st2common/tests/unit/services/test_workflow_rerun.py @@ -40,18 +40,12 @@ from st2common.services import workflows as workflow_service from st2common.transport import liveaction as lv_ac_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] RUNNER_RESULT_FAILED = (action_constants.LIVEACTION_STATUS_FAILED, {}, {}) RUNNER_RESULT_SUCCEEDED = ( diff --git a/st2common/tests/unit/services/test_workflow_service_retries.py b/st2common/tests/unit/services/test_workflow_service_retries.py index 0d6edc9cc9..0e322fe573 100644 --- a/st2common/tests/unit/services/test_workflow_service_retries.py +++ b/st2common/tests/unit/services/test_workflow_service_retries.py @@ -51,19 +51,13 @@ from st2common.transport import liveaction as lv_ac_xport from st2common.transport import workflow as wf_ex_xport from st2common.transport import publishers +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_PATH as TEST_PACK_PATH from st2tests.mocks import liveaction as mock_lv_ac_xport from st2tests.mocks import workflow as mock_wf_ex_xport -TEST_PACK = "orquesta_tests" -TEST_PACK_PATH = ( - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK -) - -PACKS = [ - TEST_PACK_PATH, - st2tests.fixturesloader.get_fixtures_packs_base_path() + "/core", -] +PACKS = [TEST_PACK_PATH, CORE_PACK_PATH] # Temporary directory used by the tests. diff --git a/st2common/tests/unit/test_action_param_utils.py b/st2common/tests/unit/test_action_param_utils.py index 8949820f40..bf73469b2c 100644 --- a/st2common/tests/unit/test_action_param_utils.py +++ b/st2common/tests/unit/test_action_param_utils.py @@ -30,6 +30,7 @@ from st2common.persistence.runner import RunnerType from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests.base import DbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader @@ -38,7 +39,6 @@ "runners": ["testrunner1.yaml", "testrunner3.yaml"], } -PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2common/tests/unit/test_actionchain_schema.py b/st2common/tests/unit/test_actionchain_schema.py index e5bba6c0e2..1b1286b975 100644 --- a/st2common/tests/unit/test_actionchain_schema.py +++ b/st2common/tests/unit/test_actionchain_schema.py @@ -18,9 +18,9 @@ from jsonschema.exceptions import ValidationError from st2common.models.system import actionchain +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader -FIXTURES_PACK = "generic" TEST_FIXTURES = { "actionchains": [ "chain1.yaml", diff --git a/st2common/tests/unit/test_config_loader.py b/st2common/tests/unit/test_config_loader.py index 3f8e23d5be..aa8a5b00fb 100644 --- a/st2common/tests/unit/test_config_loader.py +++ b/st2common/tests/unit/test_config_loader.py @@ -25,6 +25,37 @@ from st2common.util import crypto from st2tests.base import CleanDbTestCase +from st2tests.fixtures.packs.dummy_pack_1.fixture import PACK_NAME as DUMMY_PACK_1 +from st2tests.fixtures.packs.dummy_pack_4.fixture import PACK_NAME as DUMMY_PACK_4 +from st2tests.fixtures.packs.dummy_pack_5.fixture import PACK_NAME as DUMMY_PACK_5 +from st2tests.fixtures.packs.dummy_pack_17.fixture import PACK_NAME as DUMMY_PACK_17 +from st2tests.fixtures.packs.dummy_pack_schema_with_additional_items_1.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_ADDITIONAL_ITEMS_1, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_additional_properties_1.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_ADDITIONAL_PROPERTIES_1, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_nested_object_1.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_1, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_nested_object_2.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_2, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_nested_object_3.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_3, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_nested_object_4.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_4, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_nested_object_5.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_5, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_pattern_and_additional_properties_1.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_PATTERN_AND_ADDITIONAL_PROPERTIES_1, +) +from st2tests.fixtures.packs.dummy_pack_schema_with_pattern_properties_1.fixture import ( + PACK_NAME as DUMMY_PACK_SCHEMA_WITH_PATTERN_PROPERTIES_1, +) __all__ = ["ContentPackConfigLoaderTestCase"] @@ -37,7 +68,7 @@ def test_ensure_local_pack_config_feature_removed(self): # Test a scenario where all the values are loaded from pack local # config and pack global config (pack name.yaml) doesn't exist. # Test a scenario where no values are overridden in the datastore - loader = ContentPackConfigLoader(pack_name="dummy_pack_4") + loader = ContentPackConfigLoader(pack_name=DUMMY_PACK_4) config = loader.get_config() expected_config = {} @@ -47,7 +78,7 @@ def test_get_config_some_values_overriden_in_datastore(self): # Test a scenario where some values are overriden in datastore via pack # global config kvp_db = set_datastore_value_for_config_key( - pack_name="dummy_pack_5", + pack_name=DUMMY_PACK_5, key_name="api_secret", value="some_api_secret", secret=True, @@ -60,14 +91,14 @@ def test_get_config_some_values_overriden_in_datastore(self): self.assertTrue(kvp_db.secret) kvp_db = set_datastore_value_for_config_key( - pack_name="dummy_pack_5", + pack_name=DUMMY_PACK_5, key_name="private_key_path", value="some_private_key", ) self.assertEqual(kvp_db.value, "some_private_key") self.assertFalse(kvp_db.secret) - loader = ContentPackConfigLoader(pack_name="dummy_pack_5", user="joe") + loader = ContentPackConfigLoader(pack_name=DUMMY_PACK_5, user="joe") config = loader.get_config() # regions is provided in the pack global config @@ -86,19 +117,19 @@ def test_get_config_some_values_overriden_in_datastore(self): def test_get_config_default_value_from_config_schema_is_used(self): # No value is provided for "region" in the config, default value from config schema # should be used - loader = ContentPackConfigLoader(pack_name="dummy_pack_5") + loader = ContentPackConfigLoader(pack_name=DUMMY_PACK_5) config = loader.get_config() self.assertEqual(config["region"], "default-region-value") # Here a default value is specified in schema but an explicit value is provided in the # config - loader = ContentPackConfigLoader(pack_name="dummy_pack_1") + loader = ContentPackConfigLoader(pack_name=DUMMY_PACK_1) config = loader.get_config() self.assertEqual(config["region"], "us-west-1") # Config item attribute has required: false # Value is provided in the config - it should be used as provided - pack_name = "dummy_pack_5" + pack_name = DUMMY_PACK_5 loader = ContentPackConfigLoader(pack_name=pack_name) config = loader.get_config() @@ -120,7 +151,7 @@ def test_get_config_default_value_from_config_schema_is_used(self): ) def test_default_values_from_schema_are_used_when_no_config_exists(self): - pack_name = "dummy_pack_5" + pack_name = DUMMY_PACK_5 config_db = Config.get_by_pack(pack_name) # Delete the existing config loaded in setUp @@ -137,7 +168,7 @@ def test_default_values_from_schema_are_used_when_no_config_exists(self): self.assertEqual(config["region"], "default-region-value") def test_default_values_are_used_when_default_values_are_falsey(self): - pack_name = "dummy_pack_17" + pack_name = DUMMY_PACK_17 loader = ContentPackConfigLoader(pack_name=pack_name) config = loader.get_config() @@ -177,7 +208,7 @@ def test_default_values_are_used_when_default_values_are_falsey(self): def test_get_config_nested_schema_default_values_from_config_schema_are_used(self): # Special case for more complex config schemas with attributes ntesting. # Validate that the default values are also used for one level nested object properties. - pack_name = "dummy_pack_schema_with_nested_object_1" + pack_name = DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_1 # 1. None of the nested object values are provided loader = ContentPackConfigLoader(pack_name=pack_name) @@ -196,7 +227,7 @@ def test_get_config_nested_schema_default_values_from_config_schema_are_used(sel self.assertEqual(config, expected_config) # 2. Some of the nested object values are provided (host, port) - pack_name = "dummy_pack_schema_with_nested_object_2" + pack_name = DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_2 loader = ContentPackConfigLoader(pack_name=pack_name) config = loader.get_config() @@ -214,7 +245,7 @@ def test_get_config_nested_schema_default_values_from_config_schema_are_used(sel self.assertEqual(config, expected_config) # 3. Nested attribute (auth_settings.token) references a non-secret datastore value - pack_name = "dummy_pack_schema_with_nested_object_3" + pack_name = DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_3 kvp_db = set_datastore_value_for_config_key( pack_name=pack_name, @@ -241,7 +272,7 @@ def test_get_config_nested_schema_default_values_from_config_schema_are_used(sel self.assertEqual(config, expected_config) # 4. Nested attribute (auth_settings.token) references a secret datastore value - pack_name = "dummy_pack_schema_with_nested_object_4" + pack_name = DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_4 kvp_db = set_datastore_value_for_config_key( pack_name=pack_name, @@ -300,7 +331,7 @@ def test_get_config_nested_schema_default_values_from_config_schema_are_used(sel def test_get_config_dynamic_config_item_render_fails_user_friendly_exception_is_thrown( self, ): - pack_name = "dummy_pack_schema_with_nested_object_5" + pack_name = DUMMY_PACK_SCHEMA_WITH_NESTED_OBJECT_5 loader = ContentPackConfigLoader(pack_name=pack_name) # Render fails on top-level item @@ -521,7 +552,7 @@ def test_get_config_dynamic_config_item_nested_list(self): config_db.delete() def test_get_config_dynamic_config_item_under_additional_properties(self): - pack_name = "dummy_pack_schema_with_additional_properties_1" + pack_name = DUMMY_PACK_SCHEMA_WITH_ADDITIONAL_PROPERTIES_1 loader = ContentPackConfigLoader(pack_name=pack_name) encrypted_value = crypto.symmetric_encrypt( @@ -576,7 +607,7 @@ def test_get_config_dynamic_config_item_under_additional_properties(self): config_db.delete() def test_get_config_dynamic_config_item_under_pattern_properties(self): - pack_name = "dummy_pack_schema_with_pattern_properties_1" + pack_name = DUMMY_PACK_SCHEMA_WITH_PATTERN_PROPERTIES_1 loader = ContentPackConfigLoader(pack_name=pack_name) encrypted_value = crypto.symmetric_encrypt( @@ -631,7 +662,7 @@ def test_get_config_dynamic_config_item_under_pattern_properties(self): config_db.delete() def test_get_config_dynamic_config_item_properties_order_of_precedence(self): - pack_name = "dummy_pack_schema_with_pattern_and_additional_properties_1" + pack_name = DUMMY_PACK_SCHEMA_WITH_PATTERN_AND_ADDITIONAL_PROPERTIES_1 loader = ContentPackConfigLoader(pack_name=pack_name) encrypted_value_1 = crypto.symmetric_encrypt( @@ -736,7 +767,7 @@ def test_get_config_dynamic_config_item_properties_order_of_precedence(self): config_db.delete() def test_get_config_dynamic_config_item_under_additional_items(self): - pack_name = "dummy_pack_schema_with_additional_items_1" + pack_name = DUMMY_PACK_SCHEMA_WITH_ADDITIONAL_ITEMS_1 loader = ContentPackConfigLoader(pack_name=pack_name) encrypted_value = crypto.symmetric_encrypt( diff --git a/st2common/tests/unit/test_configs_registrar.py b/st2common/tests/unit/test_configs_registrar.py index 5c7afe6370..acfb3062f0 100644 --- a/st2common/tests/unit/test_configs_registrar.py +++ b/st2common/tests/unit/test_configs_registrar.py @@ -15,8 +15,6 @@ from __future__ import absolute_import -import os - import six import mock @@ -27,29 +25,31 @@ from st2tests.api import SUPER_SECRET_PARAMETER from st2tests.base import CleanDbTestCase -from st2tests import fixturesloader from st2tests.fixtures.packs.dummy_pack_1.fixture import ( PACK_NAME as DUMMY_PACK_1, PACK_PATH as PACK_1_PATH, ) - - -__all__ = ["ConfigsRegistrarTestCase"] - -PACK_6_PATH = os.path.join( - fixturesloader.get_fixtures_packs_base_path(), "dummy_pack_6" +from st2tests.fixtures.packs.dummy_pack_6.fixture import ( + PACK_NAME as DUMMY_PACK_6, + PACK_PATH as PACK_6_PATH, ) -PACK_19_PATH = os.path.join( - fixturesloader.get_fixtures_packs_base_path(), "dummy_pack_19" +from st2tests.fixtures.packs.dummy_pack_11.fixture import ( + PACK_NAME as DUMMY_PACK_11, + PACK_PATH as PACK_11_PATH, ) -PACK_11_PATH = os.path.join( - fixturesloader.get_fixtures_packs_base_path(), "dummy_pack_11" +from st2tests.fixtures.packs.dummy_pack_19.fixture import ( + PACK_NAME as DUMMY_PACK_19, + PACK_PATH as PACK_19_PATH, ) -PACK_22_PATH = os.path.join( - fixturesloader.get_fixtures_packs_base_path(), "dummy_pack_22" +from st2tests.fixtures.packs.dummy_pack_22.fixture import ( + PACK_NAME as DUMMY_PACK_22, + PACK_PATH as PACK_22_PATH, ) +__all__ = ["ConfigsRegistrarTestCase"] + + class ConfigsRegistrarTestCase(CleanDbTestCase): def test_register_configs_for_all_packs(self): # Verify DB is empty @@ -90,7 +90,7 @@ def test_register_all_configs_invalid_config_no_config_schema(self): registrar = ConfigsRegistrar(use_pack_cache=False, validate_configs=False) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_6": PACK_6_PATH} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_6: PACK_6_PATH} packs_base_paths = content_utils.get_packs_base_paths() registrar.register_from_packs(base_dirs=packs_base_paths) @@ -115,7 +115,7 @@ def test_register_all_configs_with_config_schema_validation_validation_failure_1 use_pack_cache=False, fail_on_failure=True, validate_configs=True ) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_6": PACK_6_PATH} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_6: PACK_6_PATH} # Register ConfigSchema for pack registrar._register_pack_db = mock.Mock() @@ -154,11 +154,11 @@ def test_register_all_configs_with_config_schema_validation_validation_failure_2 use_pack_cache=False, fail_on_failure=True, validate_configs=True ) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_19": PACK_19_PATH} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_19: PACK_19_PATH} # Register ConfigSchema for pack registrar._register_pack_db = mock.Mock() - registrar._register_pack(pack_name="dummy_pack_19", pack_dir=PACK_19_PATH) + registrar._register_pack(pack_name=DUMMY_PACK_19, pack_dir=PACK_19_PATH) packs_base_paths = content_utils.get_packs_base_paths() if six.PY3: @@ -198,11 +198,11 @@ def test_register_all_configs_with_config_schema_validation_validation_failure_3 use_pack_cache=False, fail_on_failure=True, validate_configs=True ) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_11": PACK_11_PATH} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_11: PACK_11_PATH} # Register ConfigSchema for pack registrar._register_pack_db = mock.Mock() - registrar._register_pack(pack_name="dummy_pack_11", pack_dir=PACK_11_PATH) + registrar._register_pack(pack_name=DUMMY_PACK_11, pack_dir=PACK_11_PATH) packs_base_paths = content_utils.get_packs_base_paths() expected_msg = ( @@ -236,11 +236,11 @@ def test_register_all_configs_with_config_schema_validation_validation_failure_4 use_pack_cache=False, fail_on_failure=True, validate_configs=True ) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_22": PACK_22_PATH} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_22: PACK_22_PATH} # Register ConfigSchema for pack registrar._register_pack_db = mock.Mock() - registrar._register_pack(pack_name="dummy_pack_22", pack_dir=PACK_22_PATH) + registrar._register_pack(pack_name=DUMMY_PACK_22, pack_dir=PACK_22_PATH) packs_base_paths = content_utils.get_packs_base_paths() expected_msg = ( diff --git a/st2common/tests/unit/test_content_utils.py b/st2common/tests/unit/test_content_utils.py index 2f1f2ebbce..c9ff10ff29 100644 --- a/st2common/tests/unit/test_content_utils.py +++ b/st2common/tests/unit/test_content_utils.py @@ -35,6 +35,7 @@ PACK_NAME as DUMMY_PACK_1, PACK_PATH as DUMMY_PACK_1_PATH, ) +from st2tests.fixtures.packs.dummy_pack_2.fixture import PACK_PATH as DUMMY_PACK_2_PATH class ContentUtilsTestCase(unittest2.TestCase): @@ -261,7 +262,7 @@ def test_get_relative_path_to_pack_file(self): # 2. Invalid path - outside pack directory expected_msg = r"file_path (.*?) is not located inside the pack directory (.*?)" - file_path = os.path.join(packs_base_paths, "dummy_pack_2/actions/lib/foo.py") + file_path = os.path.join(DUMMY_PACK_2_PATH, "actions/lib/foo.py") self.assertRaisesRegexp( ValueError, expected_msg, diff --git a/st2common/tests/unit/test_executions_util.py b/st2common/tests/unit/test_executions_util.py index 80c3e77083..4c2530155a 100644 --- a/st2common/tests/unit/test_executions_util.py +++ b/st2common/tests/unit/test_executions_util.py @@ -31,6 +31,8 @@ import st2common.util.date as date_utils from st2tests.base import CleanDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK +from st2tests.fixtures.descendants.fixture import PACK_NAME as DESCENDANTS_PACK from st2tests.fixturesloader import FixturesLoader import st2tests.config as tests_config @@ -38,8 +40,6 @@ tests_config.parse_args() -FIXTURES_PACK = "generic" - TEST_FIXTURES = { "liveactions": [ "liveaction1.yaml", @@ -229,8 +229,6 @@ def _get_action_execution(self, **kwargs): # descendants test section -DESCENDANTS_PACK = "descendants" - DESCENDANTS_FIXTURES = { "executions": [ "root_execution.yaml", diff --git a/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py b/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py index 630b14ed37..18251fb947 100644 --- a/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py +++ b/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py @@ -14,21 +14,19 @@ # limitations under the License. from __future__ import absolute_import -import os import mock from st2tests.base import BaseActionAliasTestCase -from st2tests.fixturesloader import get_fixtures_base_path +from st2tests.fixtures.packs.pack_dir_name_doesnt_match_ref.fixture import ( + PACK_NAME as PACK_NAME_NOT_THE_SAME_AS_DIR_NAME, + PACK_PATH as PACK_PATH_1, +) from st2common.exceptions.content import ParseException from st2common.models.db.actionalias import ActionAliasDB __all__ = ["PackActionAliasUnitTestUtils"] -PACK_PATH_1 = os.path.join( - get_fixtures_base_path(), "packs/pack_dir_name_doesnt_match_ref" -) - class PackActionAliasUnitTestUtils(BaseActionAliasTestCase): action_alias_name = "mock" @@ -119,7 +117,7 @@ def test_base_class_works_when_pack_directory_name_doesnt_match_pack_name(self): action_alias_db = self._get_action_alias_db_by_name(name="alias1") self.assertEqual(action_alias_db.name, "alias1") - self.assertEqual(action_alias_db.pack, "pack_name_not_the_same_as_dir_name") + self.assertEqual(action_alias_db.pack, PACK_NAME_NOT_THE_SAME_AS_DIR_NAME) # Note: We mock the original method to make testing of all the edge cases easier def _get_action_alias_db_by_name(self, name): diff --git a/st2common/tests/unit/test_param_utils.py b/st2common/tests/unit/test_param_utils.py index c5b1959780..8393f4aa11 100644 --- a/st2common/tests/unit/test_param_utils.py +++ b/st2common/tests/unit/test_param_utils.py @@ -38,11 +38,10 @@ from st2common.util.config_loader import get_config from st2tests import DbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader -FIXTURES_PACK = "generic" - TEST_MODELS = { "actions": ["action_4_action_context_param.yaml", "action_system_default.yaml"], "runners": ["testrunner1.yaml"], diff --git a/st2common/tests/unit/test_policies.py b/st2common/tests/unit/test_policies.py index f6dd9a47de..4383429fe1 100644 --- a/st2common/tests/unit/test_policies.py +++ b/st2common/tests/unit/test_policies.py @@ -17,11 +17,11 @@ from st2common.persistence.policy import PolicyType, Policy from st2common.policies import ResourcePolicyApplicator, get_driver from st2tests import DbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["PolicyTestCase"] -PACK = "generic" TEST_FIXTURES = { "runners": ["testrunner1.yaml"], "actions": ["action1.yaml"], diff --git a/st2common/tests/unit/test_policies_registrar.py b/st2common/tests/unit/test_policies_registrar.py index b666d2755b..231c477446 100644 --- a/st2common/tests/unit/test_policies_registrar.py +++ b/st2common/tests/unit/test_policies_registrar.py @@ -32,6 +32,11 @@ PACK_NAME as DUMMY_PACK_1, PACK_PATH as DUMMY_PACK_1_PATH, ) +from st2tests.fixtures.packs.dummy_pack_2.fixture import ( + PACK_NAME as DUMMY_PACK_2, + PACK_PATH as DUMMY_PACK_2_PATH, +) +from st2tests.fixtures.packs.orquesta_tests.fixture import PACK_NAME as ORQUESTA_TESTS __all__ = ["PoliciesRegistrarTestCase"] @@ -85,7 +90,7 @@ def test_register_all_policies(self): "parameters": {"retry_on": "timeout", "max_retry_count": 5}, }, "sequential.retry_on_failure": { - "pack": "orquesta_tests", + "pack": ORQUESTA_TESTS, "type": "action.retry", "parameters": {"retry_on": "failure", "max_retry_count": 1}, }, @@ -128,15 +133,13 @@ def test_register_policy_invalid_policy_type_references(self): def test_make_sure_policy_parameters_are_validated_during_register(self): # Policy where specified parameters fail schema validation registrar = PolicyRegistrar() - policy_path = os.path.join( - get_fixtures_packs_base_path(), "dummy_pack_2/policies/policy_3.yaml" - ) + policy_path = os.path.join(DUMMY_PACK_2_PATH, "policies/policy_3.yaml") expected_msg = "100 is greater than the maximum of 5" self.assertRaisesRegexp( jsonschema.ValidationError, expected_msg, registrar._register_policy, - pack="dummy_pack_2", + pack=DUMMY_PACK_2, policy=policy_path, ) diff --git a/st2common/tests/unit/test_purge_executions.py b/st2common/tests/unit/test_purge_executions.py index cb696e08ed..f43266a121 100644 --- a/st2common/tests/unit/test_purge_executions.py +++ b/st2common/tests/unit/test_purge_executions.py @@ -35,6 +35,7 @@ from st2common.persistence.liveaction import LiveAction from st2common.util import date as date_utils from st2tests.base import CleanDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_PACK from st2tests.fixturesloader import FixturesLoader from six.moves import range @@ -53,7 +54,7 @@ def setUp(self): super(TestPurgeExecutions, self).setUp() fixtures_loader = FixturesLoader() self.models = fixtures_loader.load_models( - fixtures_pack="generic", fixtures_dict=TEST_FIXTURES + fixtures_pack=GENERIC_PACK, fixtures_dict=TEST_FIXTURES ) def test_no_timestamp_doesnt_delete_things(self): diff --git a/st2common/tests/unit/test_resource_registrar.py b/st2common/tests/unit/test_resource_registrar.py index 3e25b62b90..cf619cd983 100644 --- a/st2common/tests/unit/test_resource_registrar.py +++ b/st2common/tests/unit/test_resource_registrar.py @@ -32,22 +32,40 @@ PACK_NAME as DUMMY_PACK_1, PACK_PATH as PACK_PATH_1, ) +from st2tests.fixtures.packs.dummy_pack_6.fixture import ( + PACK_NAME as DUMMY_PACK_6, + PACK_PATH as PACK_PATH_6, +) +from st2tests.fixtures.packs.dummy_pack_8.fixture import PACK_PATH as PACK_PATH_8 from st2tests.fixtures.packs.dummy_pack_10.fixture import PACK_PATH as PACK_PATH_10 +from st2tests.fixtures.packs.dummy_pack_13.fixture import PACK_PATH as PACK_PATH_13 +from st2tests.fixtures.packs.dummy_pack_14.fixture import PACK_PATH as PACK_PATH_14 +from st2tests.fixtures.packs.dummy_pack_20.fixture import ( + PACK_NAME as DUMMY_PACK_20, + PACK_PATH as PACK_PATH_20, +) +from st2tests.fixtures.packs.dummy_pack_21.fixture import ( + PACK_NAME as DUMMY_PACK_21, + PACK_PATH as PACK_PATH_21, +) +from st2tests.fixtures.packs_invalid.dummy_pack_17.fixture import ( + PACK_NAME as DUMMY_PACK_17, + PACK_PATH as PACK_PATH_17, +) +from st2tests.fixtures.packs_invalid.dummy_pack_18.fixture import ( + PACK_NAME as DUMMY_PACK_18, + PACK_PATH as PACK_PATH_18, +) + +# from st2tests.fixtures.packs.dummy_pack_12.fixture import ( +# PACK_PATH as PACK_PATH_12, +# ) # not used? __all__ = ["ResourceRegistrarTestCase"] -PACK_PATH_6 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_6") PACK_PATH_7 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_7") -PACK_PATH_8 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_8") PACK_PATH_9 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_9") -PACK_PATH_12 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_12") -PACK_PATH_13 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_13") -PACK_PATH_14 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_14") -PACK_PATH_17 = os.path.join(get_fixtures_base_path(), "packs_invalid/dummy_pack_17") -PACK_PATH_18 = os.path.join(get_fixtures_base_path(), "packs_invalid/dummy_pack_18") -PACK_PATH_20 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_20") -PACK_PATH_21 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_21") class ResourceRegistrarTestCase(CleanDbTestCase): @@ -101,13 +119,13 @@ def test_register_pack_arbitrary_properties_are_allowed(self): registrar = ResourceRegistrar(use_pack_cache=False) registrar._pack_loader.get_packs = mock.Mock() registrar._pack_loader.get_packs.return_value = { - "dummy_pack_20": PACK_PATH_20, + DUMMY_PACK_20: PACK_PATH_20, } packs_base_paths = content_utils.get_packs_base_paths() registrar.register_packs(base_dirs=packs_base_paths) # Ref is provided - pack_db = Pack.get_by_name("dummy_pack_20") + pack_db = Pack.get_by_name(DUMMY_PACK_20) self.assertEqual(pack_db.ref, "dummy_pack_20_ref") self.assertEqual(len(pack_db.contributors), 0) @@ -121,13 +139,13 @@ def test_register_pack_pack_ref(self): registrar._pack_loader.get_packs = mock.Mock() registrar._pack_loader.get_packs.return_value = { DUMMY_PACK_1: PACK_PATH_1, - "dummy_pack_6": PACK_PATH_6, + DUMMY_PACK_6: PACK_PATH_6, } packs_base_paths = content_utils.get_packs_base_paths() registrar.register_packs(base_dirs=packs_base_paths) # Ref is provided - pack_db = Pack.get_by_name("dummy_pack_6") + pack_db = Pack.get_by_name(DUMMY_PACK_6) self.assertEqual(pack_db.ref, "dummy_pack_6_ref") self.assertEqual(len(pack_db.contributors), 0) @@ -225,7 +243,7 @@ def test_register_pack_pack_stackstorm_version_and_future_parameters(self): def test_register_pack_empty_and_invalid_config_schema(self): registrar = ResourceRegistrar(use_pack_cache=False, fail_on_failure=True) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_17": PACK_PATH_17} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_17: PACK_PATH_17} packs_base_paths = content_utils.get_packs_base_paths() expected_msg = ( @@ -241,7 +259,7 @@ def test_register_pack_empty_and_invalid_config_schema(self): def test_register_pack_invalid_config_schema_invalid_attribute(self): registrar = ResourceRegistrar(use_pack_cache=False, fail_on_failure=True) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_18": PACK_PATH_18} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_18: PACK_PATH_18} packs_base_paths = content_utils.get_packs_base_paths() expected_msg = ( @@ -257,7 +275,7 @@ def test_register_pack_invalid_config_schema_invalid_attribute(self): def test_register_pack_invalid_python_versions_attribute(self): registrar = ResourceRegistrar(use_pack_cache=False, fail_on_failure=True) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {"dummy_pack_21": PACK_PATH_21} + registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_21: PACK_PATH_21} packs_base_paths = content_utils.get_packs_base_paths() expected_msg = r"'4' is not one of \['2', '3'\]" diff --git a/st2common/tests/unit/test_runners_utils.py b/st2common/tests/unit/test_runners_utils.py index 98f8acd0ea..773fa9cc39 100644 --- a/st2common/tests/unit/test_runners_utils.py +++ b/st2common/tests/unit/test_runners_utils.py @@ -27,6 +27,7 @@ from st2common.util import action_db as action_db_utils from st2tests import base from st2tests import fixturesloader +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests import config as tests_config @@ -34,8 +35,6 @@ tests_config.parse_args() -FIXTURES_PACK = "generic" - TEST_FIXTURES = { "liveactions": ["liveaction1.yaml"], "actions": ["local.yaml"], diff --git a/st2common/tests/unit/test_trigger_services.py b/st2common/tests/unit/test_trigger_services.py index b843526bc9..6f39c21d41 100644 --- a/st2common/tests/unit/test_trigger_services.py +++ b/st2common/tests/unit/test_trigger_services.py @@ -22,6 +22,7 @@ import st2common.services.triggers as trigger_service from st2tests.base import CleanDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_PACK from st2tests.fixturesloader import FixturesLoader MOCK_TRIGGER = TriggerDB( @@ -37,7 +38,7 @@ def test_create_trigger_db_from_rule(self): test_fixtures = {"rules": ["cron_timer_rule_1.yaml", "cron_timer_rule_3.yaml"]} loader = FixturesLoader() fixtures = loader.load_fixtures( - fixtures_pack="generic", fixtures_dict=test_fixtures + fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures ) rules = fixtures["rules"] @@ -61,7 +62,7 @@ def test_create_trigger_db_from_rule_duplicate(self): test_fixtures = {"rules": ["cron_timer_rule_1.yaml", "cron_timer_rule_2.yaml"]} loader = FixturesLoader() fixtures = loader.load_fixtures( - fixtures_pack="generic", fixtures_dict=test_fixtures + fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures ) rules = fixtures["rules"] @@ -86,7 +87,7 @@ def test_create_or_update_trigger_db_simple_triggers(self): test_fixtures = {"triggertypes": ["triggertype1.yaml"]} loader = FixturesLoader() fixtures = loader.save_fixtures_to_db( - fixtures_pack="generic", fixtures_dict=test_fixtures + fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures ) triggertypes = fixtures["triggertypes"] trigger_type_ref = ResourceReference.to_string_reference( @@ -118,7 +119,7 @@ def test_exception_thrown_when_rule_creation_no_trigger_yes_triggertype(self): test_fixtures = {"triggertypes": ["triggertype1.yaml"]} loader = FixturesLoader() fixtures = loader.save_fixtures_to_db( - fixtures_pack="generic", fixtures_dict=test_fixtures + fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures ) triggertypes = fixtures["triggertypes"] trigger_type_ref = ResourceReference.to_string_reference( diff --git a/st2common/tests/unit/test_virtualenvs.py b/st2common/tests/unit/test_virtualenvs.py index f5d0c3e088..565a2db917 100644 --- a/st2common/tests/unit/test_virtualenvs.py +++ b/st2common/tests/unit/test_virtualenvs.py @@ -29,6 +29,10 @@ from st2common.util.virtualenvs import install_requirements from st2common.util.virtualenvs import setup_pack_virtualenv from st2tests.fixtures.packs.dummy_pack_1.fixture import PACK_NAME as DUMMY_PACK_1 +from st2tests.fixtures.packs.dummy_pack_2.fixture import PACK_NAME as DUMMY_PACK_2 +from st2tests.fixtures.packs.pack_invalid_requirements.fixture import ( + PACK_NAME as PACK_INVALID_REQUIREMENTS, +) __all__ = ["VirtualenvUtilsTestCase"] @@ -105,7 +109,7 @@ def test_setup_pack_virtualenv_already_exists(self): def test_setup_virtualenv_update(self): # Test a virtualenv update with pack which has requirements.txt - pack_name = "dummy_pack_2" + pack_name = DUMMY_PACK_2 pack_virtualenv_dir = os.path.join(self.virtualenvs_path, pack_name) # Verify virtualenv directory doesn't exist @@ -134,7 +138,7 @@ def test_setup_virtualenv_update(self): self.assertVirtualenvExists(pack_virtualenv_dir) def test_setup_virtualenv_invalid_dependency_in_requirements_file(self): - pack_name = "pack_invalid_requirements" + pack_name = PACK_INVALID_REQUIREMENTS pack_virtualenv_dir = os.path.join(self.virtualenvs_path, pack_name) # Verify virtualenv directory doesn't exist diff --git a/st2reactor/tests/integration/test_garbage_collector.py b/st2reactor/tests/integration/test_garbage_collector.py index 5b0f890ac3..649d09e534 100644 --- a/st2reactor/tests/integration/test_garbage_collector.py +++ b/st2reactor/tests/integration/test_garbage_collector.py @@ -34,6 +34,7 @@ from st2tests.base import IntegrationTestCase from st2tests.base import CleanDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from six.moves import range @@ -58,8 +59,6 @@ TEST_FIXTURES = {"runners": ["inquirer.yaml"], "actions": ["ask.yaml"]} -FIXTURES_PACK = "generic" - class GarbageCollectorServiceTestCase(IntegrationTestCase, CleanDbTestCase): @classmethod diff --git a/st2reactor/tests/unit/test_enforce.py b/st2reactor/tests/unit/test_enforce.py index 37317e610a..72e16ec007 100644 --- a/st2reactor/tests/unit/test_enforce.py +++ b/st2reactor/tests/unit/test_enforce.py @@ -41,11 +41,11 @@ from st2reactor.rules.enforcer import RuleEnforcer from st2tests import DbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["RuleEnforcerTestCase", "RuleEnforcerDataTransformationTestCase"] -PACK = "generic" FIXTURES_1 = { "runners": ["testrunner1.yaml", "testrunner2.yaml"], "actions": ["action1.yaml", "a2.yaml", "a2_default_value.yaml"], diff --git a/st2reactor/tests/unit/test_hash_partitioner.py b/st2reactor/tests/unit/test_hash_partitioner.py index 12e522a10c..b1da7e7980 100644 --- a/st2reactor/tests/unit/test_hash_partitioner.py +++ b/st2reactor/tests/unit/test_hash_partitioner.py @@ -20,9 +20,9 @@ from st2reactor.container.hash_partitioner import HashPartitioner, Range from st2tests import config from st2tests import DbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader -PACK = "generic" FIXTURES_1 = {"sensors": ["sensor1.yaml", "sensor2.yaml", "sensor3.yaml"]} diff --git a/st2reactor/tests/unit/test_partitioners.py b/st2reactor/tests/unit/test_partitioners.py index 8c4213ec5b..4bfc5b80d5 100644 --- a/st2reactor/tests/unit/test_partitioners.py +++ b/st2reactor/tests/unit/test_partitioners.py @@ -27,9 +27,9 @@ from st2reactor.container.hash_partitioner import Range from st2tests import config from st2tests import DbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader -PACK = "generic" FIXTURES_1 = {"sensors": ["sensor1.yaml", "sensor2.yaml", "sensor3.yaml"]} diff --git a/st2reactor/tests/unit/test_rule_matcher.py b/st2reactor/tests/unit/test_rule_matcher.py index 46cc084662..78b7c3a98d 100644 --- a/st2reactor/tests/unit/test_rule_matcher.py +++ b/st2reactor/tests/unit/test_rule_matcher.py @@ -31,6 +31,7 @@ from st2tests.base import DbTestCase from st2tests.base import CleanDbTestCase +from st2tests.fixtures.backstop.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["RuleMatcherTestCase", "BackstopRuleMatcherTestCase"] @@ -285,7 +286,6 @@ def _setup_sample_rule(self, rule): return rule_db -PACK = "backstop" FIXTURES_TRIGGERS = { "triggertypes": ["triggertype1.yaml"], "triggers": ["trigger1.yaml"], diff --git a/st2reactor/tests/unit/test_tester.py b/st2reactor/tests/unit/test_tester.py index 60cd6919b8..526dc26744 100644 --- a/st2reactor/tests/unit/test_tester.py +++ b/st2reactor/tests/unit/test_tester.py @@ -21,12 +21,11 @@ from st2common.transport.publishers import PoolPublisher from st2reactor.rules.tester import RuleTester from st2tests.base import CleanDbTestCase +from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader BASE_PATH = os.path.dirname(os.path.abspath(__file__)) -FIXTURES_PACK = "generic" - TEST_MODELS_TRIGGERS = { "triggertypes": ["triggertype1.yaml", "triggertype2.yaml"], "triggers": ["trigger1.yaml", "trigger2.yaml"], From fb2adbe34a87523868686e135d992b4158e18f6e Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 16:27:24 -0500 Subject: [PATCH 3/9] update changelog entry --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7912a1cb55..a697a8a2d3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -91,7 +91,7 @@ Changed * Move from udatetime to ciso8601 for date functionality ahead of supporting python3.9 #5692 Contributed by Amanda McGuinness (@amanda11 intive) -* Refactor tests to use python imports to identify test fixtures. #5699 +* Refactor tests to use python imports to identify test fixtures. #5699 #5702 Contributed by @cognifloyd Removed From 3c5d22cece8888d3f49b9493f7d033a5967e9430 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 16:38:02 -0500 Subject: [PATCH 4/9] flake8 fixes --- st2actions/tests/unit/test_actions_registrar.py | 1 - st2common/tests/unit/services/test_packs.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/st2actions/tests/unit/test_actions_registrar.py b/st2actions/tests/unit/test_actions_registrar.py index 1426d4503a..0f3fe76e32 100644 --- a/st2actions/tests/unit/test_actions_registrar.py +++ b/st2actions/tests/unit/test_actions_registrar.py @@ -31,7 +31,6 @@ PACK_PATH as GENERIC_PACK_PATH, ) import st2tests.fixturesloader as fixtures_loader -from st2tests.fixturesloader import get_fixtures_base_path MOCK_RUNNER_TYPE_DB = RunnerTypeDB(name="run-local", runner_module="st2.runners.local") diff --git a/st2common/tests/unit/services/test_packs.py b/st2common/tests/unit/services/test_packs.py index c2cb98a8eb..e93258aa0b 100644 --- a/st2common/tests/unit/services/test_packs.py +++ b/st2common/tests/unit/services/test_packs.py @@ -23,8 +23,6 @@ import unittest2 import uuid -import st2tests - from st2common.models.db.stormbase import UIDFieldMixin from st2common.services.packs import delete_action_files_from_pack from st2common.services.packs import clone_action_files From ec8419ced3444bdbfe577c84d462c3361b0f382e Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 16:41:28 -0500 Subject: [PATCH 5/9] add more fixture.py files --- .../fixtures/packs/dummy_pack_23/__init__.py | 0 .../fixtures/packs/dummy_pack_23/fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ .../__init__.py | 0 .../fixture.py | 16 ++++++++++++++++ 8 files changed, 64 insertions(+) create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_23/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_23/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_and_additional_properties_1/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_and_additional_properties_1/fixture.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_properties_1/__init__.py create mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_properties_1/fixture.py diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_23/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_23/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_23/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_23/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_23/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_and_additional_properties_1/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_and_additional_properties_1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_and_additional_properties_1/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_and_additional_properties_1/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_and_additional_properties_1/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_properties_1/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_properties_1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_properties_1/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_properties_1/fixture.py new file mode 100644 index 0000000000..50c698989e --- /dev/null +++ b/st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_pattern_properties_1/fixture.py @@ -0,0 +1,16 @@ +# Copyright 2022 The StackStorm Authors. +# +# 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. +from st2tests import fixturesloader + +PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) From 6f2987331e0a7dd8c46e14eac064542a8798ec0a Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 16:44:47 -0500 Subject: [PATCH 6/9] drop special case fixture packs --- .../integration/test_register_content_script.py | 2 -- .../test_pack_action_alias_unit_testing_utils.py | 12 +++++++----- .../pack_dir_name_doesnt_match_ref/__init__.py | 0 .../pack_dir_name_doesnt_match_ref/fixture.py | 16 ---------------- st2tests/st2tests/fixtures/packs_1/__init__.py | 0 .../fixtures/packs_1/dummy_pack_4/__init__.py | 0 .../fixtures/packs_1/dummy_pack_4/fixture.py | 16 ---------------- 7 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/__init__.py delete mode 100644 st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py delete mode 100644 st2tests/st2tests/fixtures/packs_1/__init__.py delete mode 100644 st2tests/st2tests/fixtures/packs_1/dummy_pack_4/__init__.py delete mode 100644 st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py diff --git a/st2common/tests/integration/test_register_content_script.py b/st2common/tests/integration/test_register_content_script.py index 212b0b7b99..1c16d9e468 100644 --- a/st2common/tests/integration/test_register_content_script.py +++ b/st2common/tests/integration/test_register_content_script.py @@ -27,7 +27,6 @@ # import this so that pants can infer dependencies for the glob below from st2tests.fixtures.packs.dummy_pack_1.fixture import PACK_PATH as DUMMY_PACK_1_PATH from st2tests.fixtures.packs.dummy_pack_4.fixture import PACK_PATH as DUMMY_PACK_4_PATH -from st2tests.fixtures.packs_1.dummy_pack_4.fixture import PACK_PATH as EMPTY_PACK_PATH BASE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -117,7 +116,6 @@ def test_register_from_packs_doesnt_throw_on_missing_pack_resource_folder(self): # dummy_pack_4 only has actions folder, make sure it doesn't throw when # sensors and other resource folders are missing - self.assertIn("fixtures/packs_1/", EMPTY_PACK_PATH) # Note: We want to use a different config which sets fixtures/packs_1/ # dir as packs_base_paths cmd = [ diff --git a/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py b/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py index 18251fb947..630b14ed37 100644 --- a/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py +++ b/st2common/tests/unit/test_pack_action_alias_unit_testing_utils.py @@ -14,19 +14,21 @@ # limitations under the License. from __future__ import absolute_import +import os import mock from st2tests.base import BaseActionAliasTestCase -from st2tests.fixtures.packs.pack_dir_name_doesnt_match_ref.fixture import ( - PACK_NAME as PACK_NAME_NOT_THE_SAME_AS_DIR_NAME, - PACK_PATH as PACK_PATH_1, -) +from st2tests.fixturesloader import get_fixtures_base_path from st2common.exceptions.content import ParseException from st2common.models.db.actionalias import ActionAliasDB __all__ = ["PackActionAliasUnitTestUtils"] +PACK_PATH_1 = os.path.join( + get_fixtures_base_path(), "packs/pack_dir_name_doesnt_match_ref" +) + class PackActionAliasUnitTestUtils(BaseActionAliasTestCase): action_alias_name = "mock" @@ -117,7 +119,7 @@ def test_base_class_works_when_pack_directory_name_doesnt_match_pack_name(self): action_alias_db = self._get_action_alias_db_by_name(name="alias1") self.assertEqual(action_alias_db.name, "alias1") - self.assertEqual(action_alias_db.pack, PACK_NAME_NOT_THE_SAME_AS_DIR_NAME) + self.assertEqual(action_alias_db.pack, "pack_name_not_the_same_as_dir_name") # Note: We mock the original method to make testing of all the edge cases easier def _get_action_alias_db_by_name(self, name): diff --git a/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/__init__.py b/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py b/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/packs/pack_dir_name_doesnt_match_ref/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs_1/__init__.py b/st2tests/st2tests/fixtures/packs_1/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/__init__.py b/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py b/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py deleted file mode 100644 index 1bc75c937f..0000000000 --- a/st2tests/st2tests/fixtures/packs_1/dummy_pack_4/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2021 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) From f57f0065142ae26f268d80d485ff47cd12a2e426 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 17:41:58 -0500 Subject: [PATCH 7/9] revert changes to st2tests.fixtures.* packs as the path differs --- .../tests/unit/test_actionchain.py | 3 +- .../unit/test_actionchain_notifications.py | 5 +-- .../tests/integration/test_localrunner.py | 31 +++++++++---------- .../noop_runner/tests/unit/test_nooprunner.py | 3 +- st2actions/tests/unit/policies/test_base.py | 2 +- .../tests/unit/policies/test_concurrency.py | 2 +- .../unit/policies/test_concurrency_by_attr.py | 2 +- .../tests/unit/policies/test_retry_policy.py | 2 +- .../tests/unit/test_actions_registrar.py | 25 +++++++-------- .../tests/unit/test_execution_cancellation.py | 2 +- .../test_paramiko_remote_script_runner.py | 2 +- st2actions/tests/unit/test_policies.py | 2 +- .../tests/unit/test_runner_container.py | 3 +- st2actions/tests/unit/test_scheduler.py | 2 +- st2actions/tests/unit/test_worker.py | 3 +- .../unit/controllers/v1/test_action_alias.py | 6 ++-- .../controllers/v1/test_alias_execution.py | 3 +- st2api/tests/unit/controllers/v1/test_auth.py | 3 +- .../unit/controllers/v1/test_auth_api_keys.py | 3 +- .../controllers/v1/test_executions_auth.py | 2 +- .../v1/test_executions_descendants.py | 3 +- .../unit/controllers/v1/test_policies.py | 2 +- .../v1/test_rule_enforcement_views.py | 3 +- .../controllers/v1/test_rule_enforcements.py | 3 +- .../unit/controllers/v1/test_rule_views.py | 3 +- .../tests/unit/controllers/v1/test_rules.py | 3 +- .../tests/unit/controllers/v1/test_timers.py | 2 +- .../tests/unit/controllers/v1/test_traces.py | 3 +- st2common/tests/unit/services/test_policy.py | 3 +- st2common/tests/unit/services/test_trace.py | 3 +- .../test_trace_injection_action_services.py | 3 +- .../tests/unit/test_action_param_utils.py | 2 +- .../tests/unit/test_actionchain_schema.py | 2 +- st2common/tests/unit/test_executions_util.py | 6 ++-- st2common/tests/unit/test_param_utils.py | 3 +- st2common/tests/unit/test_policies.py | 2 +- st2common/tests/unit/test_purge_executions.py | 3 +- st2common/tests/unit/test_runners_utils.py | 3 +- st2common/tests/unit/test_trigger_services.py | 9 +++--- .../integration/test_garbage_collector.py | 3 +- st2reactor/tests/unit/test_enforce.py | 2 +- .../tests/unit/test_hash_partitioner.py | 2 +- st2reactor/tests/unit/test_partitioners.py | 2 +- st2reactor/tests/unit/test_rule_matcher.py | 2 +- st2reactor/tests/unit/test_tester.py | 3 +- .../st2tests/fixtures/aliases/__init__.py | 0 st2tests/st2tests/fixtures/aliases/fixture.py | 16 ---------- .../st2tests/fixtures/backstop/__init__.py | 0 .../st2tests/fixtures/backstop/fixture.py | 16 ---------- .../st2tests/fixtures/descendants/__init__.py | 0 .../st2tests/fixtures/descendants/fixture.py | 16 ---------- .../st2tests/fixtures/generic/__init__.py | 0 st2tests/st2tests/fixtures/generic/fixture.py | 16 ---------- .../fixtures/rule_enforcements/__init__.py | 0 .../fixtures/rule_enforcements/fixture.py | 16 ---------- st2tests/st2tests/fixtures/timers/__init__.py | 0 st2tests/st2tests/fixtures/timers/fixture.py | 16 ---------- st2tests/st2tests/fixtures/traces/__init__.py | 0 st2tests/st2tests/fixtures/traces/fixture.py | 16 ---------- 59 files changed, 99 insertions(+), 194 deletions(-) delete mode 100644 st2tests/st2tests/fixtures/aliases/__init__.py delete mode 100644 st2tests/st2tests/fixtures/aliases/fixture.py delete mode 100644 st2tests/st2tests/fixtures/backstop/__init__.py delete mode 100644 st2tests/st2tests/fixtures/backstop/fixture.py delete mode 100644 st2tests/st2tests/fixtures/descendants/__init__.py delete mode 100644 st2tests/st2tests/fixtures/descendants/fixture.py delete mode 100644 st2tests/st2tests/fixtures/generic/__init__.py delete mode 100644 st2tests/st2tests/fixtures/generic/fixture.py delete mode 100644 st2tests/st2tests/fixtures/rule_enforcements/__init__.py delete mode 100644 st2tests/st2tests/fixtures/rule_enforcements/fixture.py delete mode 100644 st2tests/st2tests/fixtures/timers/__init__.py delete mode 100644 st2tests/st2tests/fixtures/timers/fixture.py delete mode 100644 st2tests/st2tests/fixtures/traces/__init__.py delete mode 100644 st2tests/st2tests/fixtures/traces/fixture.py diff --git a/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py b/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py index 964507b191..9daed4fa90 100644 --- a/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py +++ b/contrib/runners/action_chain_runner/tests/unit/test_actionchain.py @@ -35,7 +35,6 @@ from st2common.util import action_db as action_db_util from st2common.exceptions.action import ParameterRenderingFailedException from st2tests import ExecutionDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader @@ -46,6 +45,8 @@ def __init__(self, status=LIVEACTION_STATUS_SUCCEEDED, result=""): self.result = result +FIXTURES_PACK = "generic" + TEST_MODELS = { "actions": ["a1.yaml", "a2.yaml", "action_4_action_context_param.yaml"], "runners": ["testrunner1.yaml"], diff --git a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py index dfb5a1bf49..d3387cbbac 100644 --- a/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py +++ b/contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py @@ -35,12 +35,11 @@ from st2common.transport.liveaction import LiveActionPublisher from st2common.transport.publishers import CUDPublisher -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK -from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH from st2tests.fixtures.packs.action_chain_tests.fixture import ( PACK_NAME as TEST_PACK, PACK_PATH as TEST_PACK_PATH, ) +from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH from st2tests.mocks.liveaction import MockLiveActionPublisherNonBlocking @@ -51,6 +50,8 @@ def __init__(self, status=action_constants.LIVEACTION_STATUS_SUCCEEDED, result=" self.result = result +FIXTURES_PACK = "generic" + TEST_MODELS = {"actions": ["a1.yaml", "a2.yaml"], "runners": ["testrunner1.yaml"]} MODELS = fixturesloader.FixturesLoader().load_models( diff --git a/contrib/runners/local_runner/tests/integration/test_localrunner.py b/contrib/runners/local_runner/tests/integration/test_localrunner.py index 16eb4d9199..4141c5daba 100644 --- a/contrib/runners/local_runner/tests/integration/test_localrunner.py +++ b/contrib/runners/local_runner/tests/integration/test_localrunner.py @@ -28,6 +28,7 @@ from st2common.constants import action as action_constants from st2common.persistence.execution import ActionExecutionOutput from st2tests.fixturesloader import FixturesLoader +from st2tests.fixturesloader import get_fixtures_base_path from st2common.util.api import get_full_public_api_url from st2common.util.green import shell from st2common.constants.runners import LOCAL_RUNNER_DEFAULT_ACTION_TIMEOUT @@ -35,10 +36,6 @@ from st2tests.base import CleanDbTestCase from st2tests.base import blocking_eventlet_spawn from st2tests.base import make_mock_stream_readline -from st2tests.fixtures.generic.fixture import ( - PACK_NAME as GENERIC_PACK, - PACK_PATH as GENERIC_PACK_PATH, -) from local_runner import base as local_runner from local_runner.local_shell_command_runner import LocalShellCommandRunner @@ -63,7 +60,7 @@ def setUp(self): def test_shell_command_action_basic(self): models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -97,7 +94,7 @@ def test_shell_command_action_basic(self): def test_timeout(self): models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] # smaller timeout == faster tests. @@ -112,7 +109,7 @@ def test_timeout(self): ) def test_shutdown(self): models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] runner = self._get_runner(action_db, cmd="sleep 0.1") @@ -122,7 +119,7 @@ def test_shutdown(self): def test_common_st2_env_vars_are_available_to_the_action(self): models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -147,7 +144,7 @@ def test_sudo_and_env_variable_preservation(self): # root / non-system user # Note: This test will fail if SETENV option is not present in the sudoers file models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -191,7 +188,7 @@ def test_action_stdout_and_stderr_is_stored_in_the_db(self, mock_spawn, mock_pop ) models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -228,7 +225,7 @@ def test_action_stdout_and_stderr_is_stored_in_the_db_short_running_action( # Verify that we correctly retrieve all the output and wait for stdout and stderr reading # threads for short running actions. models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -301,7 +298,7 @@ def test_action_stdout_and_stderr_is_stored_in_the_db_short_running_action( def test_shell_command_sudo_password_is_passed_to_sudo_binary(self): # Verify that sudo password is correctly passed to sudo binary via stdin models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -359,7 +356,7 @@ def test_shell_command_sudo_password_is_passed_to_sudo_binary(self): def test_shell_command_invalid_stdout_password(self): # Simulate message printed to stderr by sudo when invalid sudo password is provided models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["local.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["local.yaml"]} ) action_db = models["actions"]["local.yaml"] @@ -429,12 +426,12 @@ def setUp(self): def test_script_with_parameters_parameter_serialization(self): models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, + fixtures_pack="generic", fixtures_dict={"actions": ["local_script_with_params.yaml"]}, ) action_db = models["actions"]["local_script_with_params.yaml"] entry_point = os.path.join( - GENERIC_PACK_PATH, "actions/local_script_with_params.sh" + get_fixtures_base_path(), "generic/actions/local_script_with_params.sh" ) action_parameters = { @@ -560,12 +557,12 @@ def test_action_stdout_and_stderr_is_stored_in_the_db(self, mock_spawn, mock_pop ) models = self.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, + fixtures_pack="generic", fixtures_dict={"actions": ["local_script_with_params.yaml"]}, ) action_db = models["actions"]["local_script_with_params.yaml"] entry_point = os.path.join( - GENERIC_PACK_PATH, "actions/local_script_with_params.sh" + get_fixtures_base_path(), "generic/actions/local_script_with_params.sh" ) action_parameters = { diff --git a/contrib/runners/noop_runner/tests/unit/test_nooprunner.py b/contrib/runners/noop_runner/tests/unit/test_nooprunner.py index 67a234585b..98c66c33cd 100644 --- a/contrib/runners/noop_runner/tests/unit/test_nooprunner.py +++ b/contrib/runners/noop_runner/tests/unit/test_nooprunner.py @@ -24,7 +24,6 @@ from unittest2 import TestCase from st2common.constants import action as action_constants -from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_PACK from st2tests.fixturesloader import FixturesLoader from noop_runner import noop_runner @@ -35,7 +34,7 @@ class TestNoopRunner(TestCase): def test_noop_command_executes(self): models = TestNoopRunner.fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict={"actions": ["noop.yaml"]} + fixtures_pack="generic", fixtures_dict={"actions": ["noop.yaml"]} ) action_db = models["actions"]["noop.yaml"] diff --git a/st2actions/tests/unit/policies/test_base.py b/st2actions/tests/unit/policies/test_base.py index fb475fbf66..2e5003d89c 100644 --- a/st2actions/tests/unit/policies/test_base.py +++ b/st2actions/tests/unit/policies/test_base.py @@ -30,13 +30,13 @@ from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests.base import DbTestCase from st2tests.base import CleanDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["SchedulerPoliciesTestCase", "NotifierPoliciesTestCase"] +PACK = "generic" TEST_FIXTURES_1 = { "actions": ["action1.yaml"], "policies": [ diff --git a/st2actions/tests/unit/policies/test_concurrency.py b/st2actions/tests/unit/policies/test_concurrency.py index 1be4b86da3..647a4f074d 100644 --- a/st2actions/tests/unit/policies/test_concurrency.py +++ b/st2actions/tests/unit/policies/test_concurrency.py @@ -41,7 +41,6 @@ from st2tests import DbTestCase, EventletTestCase from st2tests import ExecutionDbTestCase import st2tests.config as tests_config -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.execution import MockExecutionPublisher from st2tests.mocks.liveaction import MockLiveActionPublisherSchedulingQueueOnly @@ -50,6 +49,7 @@ __all__ = ["ConcurrencyPolicyTestCase"] +PACK = "generic" TEST_FIXTURES = { "actions": ["action1.yaml", "action2.yaml"], "policies": ["policy_1.yaml", "policy_5.yaml"], diff --git a/st2actions/tests/unit/policies/test_concurrency_by_attr.py b/st2actions/tests/unit/policies/test_concurrency_by_attr.py index 937a4149ef..21c254a1a6 100644 --- a/st2actions/tests/unit/policies/test_concurrency_by_attr.py +++ b/st2actions/tests/unit/policies/test_concurrency_by_attr.py @@ -38,7 +38,6 @@ from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests import ExecutionDbTestCase, EventletTestCase import st2tests.config as tests_config -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.execution import MockExecutionPublisher from st2tests.mocks.liveaction import MockLiveActionPublisherSchedulingQueueOnly @@ -47,6 +46,7 @@ __all__ = ["ConcurrencyByAttributePolicyTestCase"] +PACK = "generic" TEST_FIXTURES = { "actions": ["action1.yaml", "action2.yaml"], "policies": ["policy_3.yaml", "policy_7.yaml"], diff --git a/st2actions/tests/unit/policies/test_retry_policy.py b/st2actions/tests/unit/policies/test_retry_policy.py index 8e16a7029c..21371c6a02 100644 --- a/st2actions/tests/unit/policies/test_retry_policy.py +++ b/st2actions/tests/unit/policies/test_retry_policy.py @@ -33,11 +33,11 @@ from st2actions.policies.retry import ExecutionRetryPolicyApplicator from st2tests.base import DbTestCase from st2tests.base import CleanDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["RetryPolicyTestCase"] +PACK = "generic" TEST_FIXTURES = {"actions": ["action1.yaml"], "policies": ["policy_4.yaml"]} diff --git a/st2actions/tests/unit/test_actions_registrar.py b/st2actions/tests/unit/test_actions_registrar.py index 0f3fe76e32..d01b83a05f 100644 --- a/st2actions/tests/unit/test_actions_registrar.py +++ b/st2actions/tests/unit/test_actions_registrar.py @@ -15,6 +15,8 @@ from __future__ import absolute_import +import os + import six import jsonschema import mock @@ -26,11 +28,8 @@ from st2common.models.db.runner import RunnerTypeDB import st2tests.base as tests_base -from st2tests.fixtures.generic.fixture import ( - PACK_NAME as GENERIC_PACK, - PACK_PATH as GENERIC_PACK_PATH, -) import st2tests.fixturesloader as fixtures_loader +from st2tests.fixturesloader import get_fixtures_base_path MOCK_RUNNER_TYPE_DB = RunnerTypeDB(name="run-local", runner_module="st2.runners.local") @@ -39,7 +38,7 @@ # base paths directory. This will never happen outside the context of test fixtures. @mock.patch( "st2common.content.utils.get_pack_base_path", - mock.Mock(return_value=GENERIC_PACK_PATH), + mock.Mock(return_value=os.path.join(get_fixtures_base_path(), "generic")), ) class ActionsRegistrarTest(tests_base.DbTestCase): @mock.patch.object( @@ -86,7 +85,7 @@ def test_pack_name_missing(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - GENERIC_PACK, "actions", "action_3_pack_missing.yaml" + "generic", "actions", "action_3_pack_missing.yaml" ) registrar._register_action("dummy", action_file) action_name = None @@ -110,7 +109,7 @@ def test_register_action_with_no_params(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - GENERIC_PACK, "actions", "action-with-no-parameters.yaml" + "generic", "actions", "action-with-no-parameters.yaml" ) self.assertEqual(registrar._register_action("dummy", action_file), False) @@ -127,7 +126,7 @@ def test_register_action_invalid_parameter_type_attribute(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - GENERIC_PACK, "actions", "action_invalid_param_type.yaml" + "generic", "actions", "action_invalid_param_type.yaml" ) expected_msg = "'list' is not valid under any of the given schema" @@ -151,7 +150,7 @@ def test_register_action_invalid_parameter_name(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - GENERIC_PACK, "actions", "action_invalid_parameter_name.yaml" + "generic", "actions", "action_invalid_parameter_name.yaml" ) expected_msg = ( @@ -162,7 +161,7 @@ def test_register_action_invalid_parameter_name(self): jsonschema.ValidationError, expected_msg, registrar._register_action, - GENERIC_PACK, + "generic", action_file, ) @@ -178,10 +177,10 @@ def test_invalid_params_schema(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - GENERIC_PACK, "actions", "action-invalid-schema-params.yaml" + "generic", "actions", "action-invalid-schema-params.yaml" ) try: - registrar._register_action(GENERIC_PACK, action_file) + registrar._register_action("generic", action_file) self.fail("Invalid action schema. Should have failed.") except jsonschema.ValidationError: pass @@ -198,7 +197,7 @@ def test_action_update(self): registrar = actions_registrar.ActionsRegistrar() loader = fixtures_loader.FixturesLoader() action_file = loader.get_fixture_file_path_abs( - GENERIC_PACK, "actions", "action1.yaml" + "generic", "actions", "action1.yaml" ) registrar._register_action("wolfpack", action_file) # try registering again. this should not throw errors. diff --git a/st2actions/tests/unit/test_execution_cancellation.py b/st2actions/tests/unit/test_execution_cancellation.py index 96eacc1a89..c4c535aaa9 100644 --- a/st2actions/tests/unit/test_execution_cancellation.py +++ b/st2actions/tests/unit/test_execution_cancellation.py @@ -37,7 +37,6 @@ from st2common.transport.liveaction import LiveActionPublisher from st2common.transport.publishers import CUDPublisher from st2tests import ExecutionDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.execution import MockExecutionPublisher from st2tests.mocks.liveaction import MockLiveActionPublisher @@ -48,6 +47,7 @@ TEST_FIXTURES = {"actions": ["action1.yaml"]} +PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2actions/tests/unit/test_paramiko_remote_script_runner.py b/st2actions/tests/unit/test_paramiko_remote_script_runner.py index 4f09170781..1bf67a9503 100644 --- a/st2actions/tests/unit/test_paramiko_remote_script_runner.py +++ b/st2actions/tests/unit/test_paramiko_remote_script_runner.py @@ -34,11 +34,11 @@ from remote_runner.remote_script_runner import ParamikoRemoteScriptRunner -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["ParamikoScriptRunnerTestCase"] +FIXTURES_PACK = "generic" TEST_MODELS = {"actions": ["a1.yaml"]} MODELS = FixturesLoader().load_models( diff --git a/st2actions/tests/unit/test_policies.py b/st2actions/tests/unit/test_policies.py index a2c828b39b..f16ffbcb0b 100644 --- a/st2actions/tests/unit/test_policies.py +++ b/st2actions/tests/unit/test_policies.py @@ -28,7 +28,6 @@ from st2common.transport.publishers import CUDPublisher from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests import ExecutionDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.runners import runner from st2tests.mocks.execution import MockExecutionPublisher @@ -43,6 +42,7 @@ "policies": ["policy_1.yaml", "policy_2.yaml"], } +PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2actions/tests/unit/test_runner_container.py b/st2actions/tests/unit/test_runner_container.py index 0dcb299fde..f17eeceb71 100644 --- a/st2actions/tests/unit/test_runner_container.py +++ b/st2actions/tests/unit/test_runner_container.py @@ -39,7 +39,6 @@ import st2tests.config as tests_config tests_config.parse_args() -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader @@ -65,6 +64,8 @@ ], } +FIXTURES_PACK = "generic" + NON_UTF8_RESULT = { "stderr": "", "stdout": "\x82\n", diff --git a/st2actions/tests/unit/test_scheduler.py b/st2actions/tests/unit/test_scheduler.py index 7556c7b036..1a2d63bc1c 100644 --- a/st2actions/tests/unit/test_scheduler.py +++ b/st2actions/tests/unit/test_scheduler.py @@ -25,7 +25,6 @@ import st2common from st2tests import ExecutionDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.mocks.liveaction import MockLiveActionPublisherSchedulingQueueOnly @@ -54,6 +53,7 @@ "status": "requested", } +PACK = "generic" TEST_FIXTURES = { "actions": ["action1.yaml", "action2.yaml"], "policies": ["policy_3.yaml", "policy_7.yaml"], diff --git a/st2actions/tests/unit/test_worker.py b/st2actions/tests/unit/test_worker.py index ca2bf172dc..0cf4d730f7 100644 --- a/st2actions/tests/unit/test_worker.py +++ b/st2actions/tests/unit/test_worker.py @@ -34,7 +34,6 @@ from local_runner.local_shell_command_runner import LocalShellCommandRunner from st2tests.base import DbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader import st2tests.config as tests_config from six.moves import range @@ -43,6 +42,8 @@ TEST_FIXTURES = {"actions": ["local.yaml"]} +FIXTURES_PACK = "generic" + NON_UTF8_RESULT = { "stderr": "", "stdout": "\x82\n", diff --git a/st2api/tests/unit/controllers/v1/test_action_alias.py b/st2api/tests/unit/controllers/v1/test_action_alias.py index bf31469c57..208ed082be 100644 --- a/st2api/tests/unit/controllers/v1/test_action_alias.py +++ b/st2api/tests/unit/controllers/v1/test_action_alias.py @@ -16,13 +16,13 @@ from st2common.models.api.action import ActionAliasAPI from st2api.controllers.v1.actionalias import ActionAliasController -from st2tests.fixtures.aliases.fixture import PACK_NAME as FIXTURES_PACK -from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest from st2tests.api import APIControllerWithIncludeAndExcludeFilterTestCase +FIXTURES_PACK = "aliases" + TEST_MODELS = { "aliases": [ "alias1.yaml", @@ -36,6 +36,8 @@ "aliases": ["alias3.yaml"], } +GENERIC_FIXTURES_PACK = "generic" + TEST_LOAD_MODELS_GENERIC = {"aliases": ["alias3.yaml"], "runners": ["testrunner1.yaml"]} diff --git a/st2api/tests/unit/controllers/v1/test_alias_execution.py b/st2api/tests/unit/controllers/v1/test_alias_execution.py index 44261fde3f..4b3fa51e26 100644 --- a/st2api/tests/unit/controllers/v1/test_alias_execution.py +++ b/st2api/tests/unit/controllers/v1/test_alias_execution.py @@ -21,10 +21,11 @@ from st2common.models.db.execution import ActionExecutionDB from st2common.services import action as action_service from st2tests.api import SUPER_SECRET_PARAMETER -from st2tests.fixtures.aliases.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest +FIXTURES_PACK = "aliases" + TEST_MODELS = { "aliases": [ "alias1.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_auth.py b/st2api/tests/unit/controllers/v1/test_auth.py index a5a5aec0de..7fad0d816f 100644 --- a/st2api/tests/unit/controllers/v1/test_auth.py +++ b/st2api/tests/unit/controllers/v1/test_auth.py @@ -25,7 +25,6 @@ from st2common.models.db.auth import ApiKeyDB, TokenDB, UserDB from st2common.persistence.auth import ApiKey, Token, User from st2common.exceptions.auth import TokenNotFoundError -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader OBJ_ID = bson.ObjectId() @@ -174,6 +173,8 @@ def test_token_not_provided(self): self.assertEqual(response.status_int, 401) +FIXTURES_PACK = "generic" + TEST_MODELS = {"apikeys": ["apikey1.yaml", "apikey_disabled.yaml"]} # Hardcoded keys matching the fixtures. Lazy way to workaround one-way hash and still use fixtures. diff --git a/st2api/tests/unit/controllers/v1/test_auth_api_keys.py b/st2api/tests/unit/controllers/v1/test_auth_api_keys.py index ad2e0e5bc4..763008557f 100644 --- a/st2api/tests/unit/controllers/v1/test_auth_api_keys.py +++ b/st2api/tests/unit/controllers/v1/test_auth_api_keys.py @@ -19,10 +19,11 @@ from six.moves import http_client from st2common.constants.secrets import MASKED_ATTRIBUTE_VALUE from st2common.persistence.auth import ApiKey -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest +FIXTURES_PACK = "generic" + TEST_MODELS = { "apikeys": [ "apikey1.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_executions_auth.py b/st2api/tests/unit/controllers/v1/test_executions_auth.py index 8ffe5ac3eb..04392b319c 100644 --- a/st2api/tests/unit/controllers/v1/test_executions_auth.py +++ b/st2api/tests/unit/controllers/v1/test_executions_auth.py @@ -44,7 +44,6 @@ from st2common.util import crypto as crypto_utils from st2common.util import date as date_utils from st2tests.api import SUPER_SECRET_PARAMETER -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -107,6 +106,7 @@ id=bson.ObjectId(), user="tokenuser", token=uuid.uuid4().hex, expiry=EXPIRY ) +FIXTURES_PACK = "generic" FIXTURES = {"users": ["system_user.yaml", "token_user.yaml"]} # These parameters are used for the tests of getting value from datastore and decrypting it at diff --git a/st2api/tests/unit/controllers/v1/test_executions_descendants.py b/st2api/tests/unit/controllers/v1/test_executions_descendants.py index 55b1c12f53..945e03feeb 100644 --- a/st2api/tests/unit/controllers/v1/test_executions_descendants.py +++ b/st2api/tests/unit/controllers/v1/test_executions_descendants.py @@ -15,11 +15,12 @@ import six -from st2tests.fixtures.descendants.fixture import PACK_NAME as DESCENDANTS_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest +DESCENDANTS_PACK = "descendants" + DESCENDANTS_FIXTURES = { "executions": [ "root_execution.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_policies.py b/st2api/tests/unit/controllers/v1/test_policies.py index c68cb31bbc..3127b3aeb7 100644 --- a/st2api/tests/unit/controllers/v1/test_policies.py +++ b/st2api/tests/unit/controllers/v1/test_policies.py @@ -22,7 +22,6 @@ from st2common.transport.publishers import PoolPublisher from st2api.controllers.v1.policies import PolicyTypeController from st2api.controllers.v1.policies import PolicyController -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -36,6 +35,7 @@ "policies": ["policy_1.yaml", "policy_2.yaml"], } +PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py b/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py index 29459effe3..0a7a104d35 100644 --- a/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py +++ b/st2api/tests/unit/controllers/v1/test_rule_enforcement_views.py @@ -16,7 +16,6 @@ import six from st2api.controllers.v1.rule_enforcement_views import RuleEnforcementViewController -from st2tests.fixtures.rule_enforcements.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -32,6 +31,8 @@ "triggerinstances": ["trigger_instance_1.yaml"], } +FIXTURES_PACK = "rule_enforcements" + class RuleEnforcementViewsControllerTestCase( FunctionalTest, APIControllerWithIncludeAndExcludeFilterTestCase diff --git a/st2api/tests/unit/controllers/v1/test_rule_enforcements.py b/st2api/tests/unit/controllers/v1/test_rule_enforcements.py index 5a5988ae7c..f2de1e2b2a 100644 --- a/st2api/tests/unit/controllers/v1/test_rule_enforcements.py +++ b/st2api/tests/unit/controllers/v1/test_rule_enforcements.py @@ -16,7 +16,6 @@ import six from st2api.controllers.v1.rule_enforcements import RuleEnforcementController -from st2tests.fixtures.rule_enforcements.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -28,6 +27,8 @@ "enforcements": ["enforcement1.yaml", "enforcement2.yaml", "enforcement3.yaml"] } +FIXTURES_PACK = "rule_enforcements" + class RuleEnforcementControllerTestCase( FunctionalTest, APIControllerWithIncludeAndExcludeFilterTestCase diff --git a/st2api/tests/unit/controllers/v1/test_rule_views.py b/st2api/tests/unit/controllers/v1/test_rule_views.py index f3b29fcc7f..cafc1b7cf2 100644 --- a/st2api/tests/unit/controllers/v1/test_rule_views.py +++ b/st2api/tests/unit/controllers/v1/test_rule_views.py @@ -22,7 +22,6 @@ from st2common.models.system.common import ResourceReference from st2api.controllers.v1.rule_views import RuleViewController -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -39,6 +38,8 @@ TEST_FIXTURES_RULES = {"rules": ["rule1.yaml", "rule4.yaml", "rule5.yaml"]} +FIXTURES_PACK = "generic" + class RuleViewControllerTestCase( FunctionalTest, APIControllerWithIncludeAndExcludeFilterTestCase diff --git a/st2api/tests/unit/controllers/v1/test_rules.py b/st2api/tests/unit/controllers/v1/test_rules.py index d3e30c1c4a..daf6845bcb 100644 --- a/st2api/tests/unit/controllers/v1/test_rules.py +++ b/st2api/tests/unit/controllers/v1/test_rules.py @@ -26,7 +26,6 @@ from st2common.models.system.common import ResourceReference from st2common.transport.publishers import PoolPublisher from st2api.controllers.v1.rules import RuleController -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest @@ -41,6 +40,8 @@ "triggertypes": ["triggertype1.yaml", "triggertype_with_parameters_2.yaml"], } +FIXTURES_PACK = "generic" + @mock.patch.object(PoolPublisher, "publish", mock.MagicMock()) class RulesControllerTestCase( diff --git a/st2api/tests/unit/controllers/v1/test_timers.py b/st2api/tests/unit/controllers/v1/test_timers.py index fdf32e5b2f..cb57844539 100644 --- a/st2api/tests/unit/controllers/v1/test_timers.py +++ b/st2api/tests/unit/controllers/v1/test_timers.py @@ -22,7 +22,6 @@ from st2common.models.system.common import ResourceReference from st2tests.base import DbTestCase -from st2tests.fixtures.timers.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader from st2common.constants.triggers import ( INTERVAL_TIMER_TRIGGER_REF, @@ -32,6 +31,7 @@ from st2tests.api import FunctionalTest +PACK = "timers" FIXTURES = { "triggers": [ "cron1.yaml", diff --git a/st2api/tests/unit/controllers/v1/test_traces.py b/st2api/tests/unit/controllers/v1/test_traces.py index 01e630dc2b..9322a6b782 100644 --- a/st2api/tests/unit/controllers/v1/test_traces.py +++ b/st2api/tests/unit/controllers/v1/test_traces.py @@ -19,12 +19,13 @@ monkey_patch() from st2api.controllers.v1.traces import TracesController -from st2tests.fixtures.traces.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests.api import FunctionalTest from st2tests.api import APIControllerWithIncludeAndExcludeFilterTestCase +FIXTURES_PACK = "traces" + TEST_MODELS = { "traces": [ "trace_empty.yaml", diff --git a/st2common/tests/unit/services/test_policy.py b/st2common/tests/unit/services/test_policy.py index a590322452..128ce1defe 100644 --- a/st2common/tests/unit/services/test_policy.py +++ b/st2common/tests/unit/services/test_policy.py @@ -30,10 +30,11 @@ from st2common.services import policies as policy_service import st2tests -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests import fixturesloader as fixtures +PACK = "generic" + TEST_FIXTURES = { "actions": [ "action1.yaml", # wolfpack.action-1 diff --git a/st2common/tests/unit/services/test_trace.py b/st2common/tests/unit/services/test_trace.py index 39db4c7ade..807dc4251d 100644 --- a/st2common/tests/unit/services/test_trace.py +++ b/st2common/tests/unit/services/test_trace.py @@ -26,11 +26,12 @@ from st2common.models.api.trace import TraceContext from st2common.persistence.trace import Trace from st2common.services import trace as trace_service -from st2tests.fixtures.traces.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests import DbTestCase +FIXTURES_PACK = "traces" + TEST_MODELS = OrderedDict( ( ( diff --git a/st2common/tests/unit/services/test_trace_injection_action_services.py b/st2common/tests/unit/services/test_trace_injection_action_services.py index 716aed61ec..4b4fe0d177 100644 --- a/st2common/tests/unit/services/test_trace_injection_action_services.py +++ b/st2common/tests/unit/services/test_trace_injection_action_services.py @@ -18,10 +18,11 @@ from st2common.persistence.liveaction import LiveAction from st2common.persistence.trace import Trace import st2common.services.action as action_services -from st2tests.fixtures.traces.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from st2tests import DbTestCase +FIXTURES_PACK = "traces" + TEST_MODELS = { "executions": ["traceable_execution.yaml"], "liveactions": ["traceable_liveaction.yaml"], diff --git a/st2common/tests/unit/test_action_param_utils.py b/st2common/tests/unit/test_action_param_utils.py index bf73469b2c..8949820f40 100644 --- a/st2common/tests/unit/test_action_param_utils.py +++ b/st2common/tests/unit/test_action_param_utils.py @@ -30,7 +30,6 @@ from st2common.persistence.runner import RunnerType from st2common.bootstrap import runnersregistrar as runners_registrar from st2tests.base import DbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader @@ -39,6 +38,7 @@ "runners": ["testrunner1.yaml", "testrunner3.yaml"], } +PACK = "generic" LOADER = FixturesLoader() FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES) diff --git a/st2common/tests/unit/test_actionchain_schema.py b/st2common/tests/unit/test_actionchain_schema.py index 1b1286b975..e5bba6c0e2 100644 --- a/st2common/tests/unit/test_actionchain_schema.py +++ b/st2common/tests/unit/test_actionchain_schema.py @@ -18,9 +18,9 @@ from jsonschema.exceptions import ValidationError from st2common.models.system import actionchain -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader +FIXTURES_PACK = "generic" TEST_FIXTURES = { "actionchains": [ "chain1.yaml", diff --git a/st2common/tests/unit/test_executions_util.py b/st2common/tests/unit/test_executions_util.py index 4c2530155a..80c3e77083 100644 --- a/st2common/tests/unit/test_executions_util.py +++ b/st2common/tests/unit/test_executions_util.py @@ -31,8 +31,6 @@ import st2common.util.date as date_utils from st2tests.base import CleanDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK -from st2tests.fixtures.descendants.fixture import PACK_NAME as DESCENDANTS_PACK from st2tests.fixturesloader import FixturesLoader import st2tests.config as tests_config @@ -40,6 +38,8 @@ tests_config.parse_args() +FIXTURES_PACK = "generic" + TEST_FIXTURES = { "liveactions": [ "liveaction1.yaml", @@ -229,6 +229,8 @@ def _get_action_execution(self, **kwargs): # descendants test section +DESCENDANTS_PACK = "descendants" + DESCENDANTS_FIXTURES = { "executions": [ "root_execution.yaml", diff --git a/st2common/tests/unit/test_param_utils.py b/st2common/tests/unit/test_param_utils.py index 8393f4aa11..c5b1959780 100644 --- a/st2common/tests/unit/test_param_utils.py +++ b/st2common/tests/unit/test_param_utils.py @@ -38,10 +38,11 @@ from st2common.util.config_loader import get_config from st2tests import DbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader +FIXTURES_PACK = "generic" + TEST_MODELS = { "actions": ["action_4_action_context_param.yaml", "action_system_default.yaml"], "runners": ["testrunner1.yaml"], diff --git a/st2common/tests/unit/test_policies.py b/st2common/tests/unit/test_policies.py index 4383429fe1..f6dd9a47de 100644 --- a/st2common/tests/unit/test_policies.py +++ b/st2common/tests/unit/test_policies.py @@ -17,11 +17,11 @@ from st2common.persistence.policy import PolicyType, Policy from st2common.policies import ResourcePolicyApplicator, get_driver from st2tests import DbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["PolicyTestCase"] +PACK = "generic" TEST_FIXTURES = { "runners": ["testrunner1.yaml"], "actions": ["action1.yaml"], diff --git a/st2common/tests/unit/test_purge_executions.py b/st2common/tests/unit/test_purge_executions.py index f43266a121..cb696e08ed 100644 --- a/st2common/tests/unit/test_purge_executions.py +++ b/st2common/tests/unit/test_purge_executions.py @@ -35,7 +35,6 @@ from st2common.persistence.liveaction import LiveAction from st2common.util import date as date_utils from st2tests.base import CleanDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_PACK from st2tests.fixturesloader import FixturesLoader from six.moves import range @@ -54,7 +53,7 @@ def setUp(self): super(TestPurgeExecutions, self).setUp() fixtures_loader = FixturesLoader() self.models = fixtures_loader.load_models( - fixtures_pack=GENERIC_PACK, fixtures_dict=TEST_FIXTURES + fixtures_pack="generic", fixtures_dict=TEST_FIXTURES ) def test_no_timestamp_doesnt_delete_things(self): diff --git a/st2common/tests/unit/test_runners_utils.py b/st2common/tests/unit/test_runners_utils.py index 773fa9cc39..98f8acd0ea 100644 --- a/st2common/tests/unit/test_runners_utils.py +++ b/st2common/tests/unit/test_runners_utils.py @@ -27,7 +27,6 @@ from st2common.util import action_db as action_db_utils from st2tests import base from st2tests import fixturesloader -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests import config as tests_config @@ -35,6 +34,8 @@ tests_config.parse_args() +FIXTURES_PACK = "generic" + TEST_FIXTURES = { "liveactions": ["liveaction1.yaml"], "actions": ["local.yaml"], diff --git a/st2common/tests/unit/test_trigger_services.py b/st2common/tests/unit/test_trigger_services.py index 6f39c21d41..b843526bc9 100644 --- a/st2common/tests/unit/test_trigger_services.py +++ b/st2common/tests/unit/test_trigger_services.py @@ -22,7 +22,6 @@ import st2common.services.triggers as trigger_service from st2tests.base import CleanDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as GENERIC_PACK from st2tests.fixturesloader import FixturesLoader MOCK_TRIGGER = TriggerDB( @@ -38,7 +37,7 @@ def test_create_trigger_db_from_rule(self): test_fixtures = {"rules": ["cron_timer_rule_1.yaml", "cron_timer_rule_3.yaml"]} loader = FixturesLoader() fixtures = loader.load_fixtures( - fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures + fixtures_pack="generic", fixtures_dict=test_fixtures ) rules = fixtures["rules"] @@ -62,7 +61,7 @@ def test_create_trigger_db_from_rule_duplicate(self): test_fixtures = {"rules": ["cron_timer_rule_1.yaml", "cron_timer_rule_2.yaml"]} loader = FixturesLoader() fixtures = loader.load_fixtures( - fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures + fixtures_pack="generic", fixtures_dict=test_fixtures ) rules = fixtures["rules"] @@ -87,7 +86,7 @@ def test_create_or_update_trigger_db_simple_triggers(self): test_fixtures = {"triggertypes": ["triggertype1.yaml"]} loader = FixturesLoader() fixtures = loader.save_fixtures_to_db( - fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures + fixtures_pack="generic", fixtures_dict=test_fixtures ) triggertypes = fixtures["triggertypes"] trigger_type_ref = ResourceReference.to_string_reference( @@ -119,7 +118,7 @@ def test_exception_thrown_when_rule_creation_no_trigger_yes_triggertype(self): test_fixtures = {"triggertypes": ["triggertype1.yaml"]} loader = FixturesLoader() fixtures = loader.save_fixtures_to_db( - fixtures_pack=GENERIC_PACK, fixtures_dict=test_fixtures + fixtures_pack="generic", fixtures_dict=test_fixtures ) triggertypes = fixtures["triggertypes"] trigger_type_ref = ResourceReference.to_string_reference( diff --git a/st2reactor/tests/integration/test_garbage_collector.py b/st2reactor/tests/integration/test_garbage_collector.py index 649d09e534..5b0f890ac3 100644 --- a/st2reactor/tests/integration/test_garbage_collector.py +++ b/st2reactor/tests/integration/test_garbage_collector.py @@ -34,7 +34,6 @@ from st2tests.base import IntegrationTestCase from st2tests.base import CleanDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader from six.moves import range @@ -59,6 +58,8 @@ TEST_FIXTURES = {"runners": ["inquirer.yaml"], "actions": ["ask.yaml"]} +FIXTURES_PACK = "generic" + class GarbageCollectorServiceTestCase(IntegrationTestCase, CleanDbTestCase): @classmethod diff --git a/st2reactor/tests/unit/test_enforce.py b/st2reactor/tests/unit/test_enforce.py index 72e16ec007..37317e610a 100644 --- a/st2reactor/tests/unit/test_enforce.py +++ b/st2reactor/tests/unit/test_enforce.py @@ -41,11 +41,11 @@ from st2reactor.rules.enforcer import RuleEnforcer from st2tests import DbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["RuleEnforcerTestCase", "RuleEnforcerDataTransformationTestCase"] +PACK = "generic" FIXTURES_1 = { "runners": ["testrunner1.yaml", "testrunner2.yaml"], "actions": ["action1.yaml", "a2.yaml", "a2_default_value.yaml"], diff --git a/st2reactor/tests/unit/test_hash_partitioner.py b/st2reactor/tests/unit/test_hash_partitioner.py index b1da7e7980..12e522a10c 100644 --- a/st2reactor/tests/unit/test_hash_partitioner.py +++ b/st2reactor/tests/unit/test_hash_partitioner.py @@ -20,9 +20,9 @@ from st2reactor.container.hash_partitioner import HashPartitioner, Range from st2tests import config from st2tests import DbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader +PACK = "generic" FIXTURES_1 = {"sensors": ["sensor1.yaml", "sensor2.yaml", "sensor3.yaml"]} diff --git a/st2reactor/tests/unit/test_partitioners.py b/st2reactor/tests/unit/test_partitioners.py index 4bfc5b80d5..8c4213ec5b 100644 --- a/st2reactor/tests/unit/test_partitioners.py +++ b/st2reactor/tests/unit/test_partitioners.py @@ -27,9 +27,9 @@ from st2reactor.container.hash_partitioner import Range from st2tests import config from st2tests import DbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader +PACK = "generic" FIXTURES_1 = {"sensors": ["sensor1.yaml", "sensor2.yaml", "sensor3.yaml"]} diff --git a/st2reactor/tests/unit/test_rule_matcher.py b/st2reactor/tests/unit/test_rule_matcher.py index 78b7c3a98d..46cc084662 100644 --- a/st2reactor/tests/unit/test_rule_matcher.py +++ b/st2reactor/tests/unit/test_rule_matcher.py @@ -31,7 +31,6 @@ from st2tests.base import DbTestCase from st2tests.base import CleanDbTestCase -from st2tests.fixtures.backstop.fixture import PACK_NAME as PACK from st2tests.fixturesloader import FixturesLoader __all__ = ["RuleMatcherTestCase", "BackstopRuleMatcherTestCase"] @@ -286,6 +285,7 @@ def _setup_sample_rule(self, rule): return rule_db +PACK = "backstop" FIXTURES_TRIGGERS = { "triggertypes": ["triggertype1.yaml"], "triggers": ["trigger1.yaml"], diff --git a/st2reactor/tests/unit/test_tester.py b/st2reactor/tests/unit/test_tester.py index 526dc26744..60cd6919b8 100644 --- a/st2reactor/tests/unit/test_tester.py +++ b/st2reactor/tests/unit/test_tester.py @@ -21,11 +21,12 @@ from st2common.transport.publishers import PoolPublisher from st2reactor.rules.tester import RuleTester from st2tests.base import CleanDbTestCase -from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK from st2tests.fixturesloader import FixturesLoader BASE_PATH = os.path.dirname(os.path.abspath(__file__)) +FIXTURES_PACK = "generic" + TEST_MODELS_TRIGGERS = { "triggertypes": ["triggertype1.yaml", "triggertype2.yaml"], "triggers": ["trigger1.yaml", "trigger2.yaml"], diff --git a/st2tests/st2tests/fixtures/aliases/__init__.py b/st2tests/st2tests/fixtures/aliases/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/aliases/fixture.py b/st2tests/st2tests/fixtures/aliases/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/aliases/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/backstop/__init__.py b/st2tests/st2tests/fixtures/backstop/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/backstop/fixture.py b/st2tests/st2tests/fixtures/backstop/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/backstop/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/descendants/__init__.py b/st2tests/st2tests/fixtures/descendants/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/descendants/fixture.py b/st2tests/st2tests/fixtures/descendants/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/descendants/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/generic/__init__.py b/st2tests/st2tests/fixtures/generic/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/generic/fixture.py b/st2tests/st2tests/fixtures/generic/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/generic/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/rule_enforcements/__init__.py b/st2tests/st2tests/fixtures/rule_enforcements/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/rule_enforcements/fixture.py b/st2tests/st2tests/fixtures/rule_enforcements/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/rule_enforcements/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/timers/__init__.py b/st2tests/st2tests/fixtures/timers/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/timers/fixture.py b/st2tests/st2tests/fixtures/timers/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/timers/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/traces/__init__.py b/st2tests/st2tests/fixtures/traces/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/traces/fixture.py b/st2tests/st2tests/fixtures/traces/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/traces/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) From 503468bfd094a51897c03a2a9391a30983a8e633 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 17:46:45 -0500 Subject: [PATCH 8/9] revert changes to st2tests.fixtures.packs_invalid.* packs as the path differs --- st2common/tests/unit/test_resource_registrar.py | 14 ++++---------- .../st2tests/fixtures/packs_invalid/__init__.py | 0 .../packs_invalid/dummy_pack_17/__init__.py | 0 .../packs_invalid/dummy_pack_17/fixture.py | 16 ---------------- .../packs_invalid/dummy_pack_18/__init__.py | 0 .../packs_invalid/dummy_pack_18/fixture.py | 16 ---------------- 6 files changed, 4 insertions(+), 42 deletions(-) delete mode 100644 st2tests/st2tests/fixtures/packs_invalid/__init__.py delete mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/__init__.py delete mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py delete mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/__init__.py delete mode 100644 st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py diff --git a/st2common/tests/unit/test_resource_registrar.py b/st2common/tests/unit/test_resource_registrar.py index cf619cd983..a1935af7b5 100644 --- a/st2common/tests/unit/test_resource_registrar.py +++ b/st2common/tests/unit/test_resource_registrar.py @@ -48,14 +48,6 @@ PACK_NAME as DUMMY_PACK_21, PACK_PATH as PACK_PATH_21, ) -from st2tests.fixtures.packs_invalid.dummy_pack_17.fixture import ( - PACK_NAME as DUMMY_PACK_17, - PACK_PATH as PACK_PATH_17, -) -from st2tests.fixtures.packs_invalid.dummy_pack_18.fixture import ( - PACK_NAME as DUMMY_PACK_18, - PACK_PATH as PACK_PATH_18, -) # from st2tests.fixtures.packs.dummy_pack_12.fixture import ( # PACK_PATH as PACK_PATH_12, @@ -66,6 +58,8 @@ PACK_PATH_7 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_7") PACK_PATH_9 = os.path.join(get_fixtures_base_path(), "packs/dummy_pack_9") +PACK_PATH_17 = os.path.join(get_fixtures_base_path(), "packs_invalid/dummy_pack_17") +PACK_PATH_18 = os.path.join(get_fixtures_base_path(), "packs_invalid/dummy_pack_18") class ResourceRegistrarTestCase(CleanDbTestCase): @@ -243,7 +237,7 @@ def test_register_pack_pack_stackstorm_version_and_future_parameters(self): def test_register_pack_empty_and_invalid_config_schema(self): registrar = ResourceRegistrar(use_pack_cache=False, fail_on_failure=True) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_17: PACK_PATH_17} + registrar._pack_loader.get_packs.return_value = {"dummy_pack_17": PACK_PATH_17} packs_base_paths = content_utils.get_packs_base_paths() expected_msg = ( @@ -259,7 +253,7 @@ def test_register_pack_empty_and_invalid_config_schema(self): def test_register_pack_invalid_config_schema_invalid_attribute(self): registrar = ResourceRegistrar(use_pack_cache=False, fail_on_failure=True) registrar._pack_loader.get_packs = mock.Mock() - registrar._pack_loader.get_packs.return_value = {DUMMY_PACK_18: PACK_PATH_18} + registrar._pack_loader.get_packs.return_value = {"dummy_pack_18": PACK_PATH_18} packs_base_paths = content_utils.get_packs_base_paths() expected_msg = ( diff --git a/st2tests/st2tests/fixtures/packs_invalid/__init__.py b/st2tests/st2tests/fixtures/packs_invalid/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/__init__.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py deleted file mode 100644 index 1bc75c937f..0000000000 --- a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_17/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2021 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/__init__.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py b/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py deleted file mode 100644 index 1bc75c937f..0000000000 --- a/st2tests/st2tests/fixtures/packs_invalid/dummy_pack_18/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2021 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__) From 4f37ff178f0381d0e0105240849f9769f496a15c Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 10 Aug 2022 18:37:07 -0500 Subject: [PATCH 9/9] remove fixture vars for dummy_pack_16 which needs special handling --- .../fixtures/packs/dummy_pack_16/__init__.py | 0 .../fixtures/packs/dummy_pack_16/fixture.py | 16 ---------------- 2 files changed, 16 deletions(-) delete mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_16/__init__.py delete mode 100644 st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_16/__init__.py b/st2tests/st2tests/fixtures/packs/dummy_pack_16/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py b/st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py deleted file mode 100644 index 50c698989e..0000000000 --- a/st2tests/st2tests/fixtures/packs/dummy_pack_16/fixture.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2022 The StackStorm Authors. -# -# 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. -from st2tests import fixturesloader - -PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__)