Skip to content

Commit b7474e0

Browse files
authored
Merge branch 'master' into tsc/bishopbm1
2 parents 138bf2d + 675b1e6 commit b7474e0

File tree

235 files changed

+2029
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+2029
-545
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ nosetests.xml
5050
htmlcov
5151
benchmark_histograms/
5252

53+
# Pants workspace files
54+
/.pants.d/
55+
/dist/
56+
/.pids
57+
/.pants.workdir.file_lock*
58+
5359
# Mr Developer
5460
.idea
5561
.DS_Store

CHANGELOG.rst

+19-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Fixed
1919

2020
Contributed by @S-T-A-R-L-O-R-D
2121

22+
* Fixed a bug where calling 'get_by_name' on client for getting key details was not returning any results despite key being stored. #5677
23+
24+
Contributed by @bharath-orchestral
25+
2226

2327
* Fixed ``st2client/st2client/base.py`` file to use ``https_proxy``(not ``http_proxy``) to check HTTPS_PROXY environment variables.
2428

@@ -29,6 +33,12 @@ Fixed
2933

3034
* Fixed eventlet monkey patching so more of the unit tests work under pytest. #5689
3135

36+
* Fix and reenable prance-based openapi spec validation, but make our custom ``x-api-model`` validation optional as the spec is out-of-date. #5709
37+
Contributed by @cognifloyd
38+
39+
* Fixed generation of `st2.conf.sample` to show correct syntax for `[sensorcontainer].partition_provider` (space separated `key:value` pairs). #5710
40+
Contributed by @cognifloyd
41+
3242
Added
3343
~~~~~
3444

@@ -41,6 +51,11 @@ Added
4151
* Added purging of old tokens. #5679
4252
Contributed by Amanda McGuinness (@amanda11 intive)
4353

54+
* Begin introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)
55+
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
56+
to pants' use of PEX lockfiles. This is not a user-facing addition. #5713
57+
Contributed by @cognifloyd
58+
4459
Changed
4560
~~~~~~~
4661

@@ -91,7 +106,10 @@ Changed
91106
* Move from udatetime to ciso8601 for date functionality ahead of supporting python3.9 #5692
92107
Contributed by Amanda McGuinness (@amanda11 intive)
93108

94-
* Refactor tests to use python imports to identify test fixtures. #5699
109+
* Refactor tests to use python imports to identify test fixtures. #5699 #5702 #5703 #5704 #5705 #5706
110+
Contributed by @cognifloyd
111+
112+
* Refactor ``st2-generate-schemas`` so that logic is in an importable module. #5708
95113
Contributed by @cognifloyd
96114

97115
Removed

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,7 @@ configgen: requirements .configgen
317317
@echo
318318
@echo "================== config gen ===================="
319319
@echo
320-
echo "# Sample config which contains all the available options which the corresponding descriptions" > conf/st2.conf.sample;
321-
echo "# Note: This file is automatically generated using tools/config_gen.py - DO NOT UPDATE MANUALLY" >> conf/st2.conf.sample
322-
echo "" >> conf/st2.conf.sample
323-
. $(VIRTUALENV_DIR)/bin/activate; python ./tools/config_gen.py >> conf/st2.conf.sample;
320+
. $(VIRTUALENV_DIR)/bin/activate; python ./tools/config_gen.py > conf/st2.conf.sample;
324321

325322
.PHONY: schemasgen
326323
schemasgen: requirements .schemasgen

conf/st2.conf.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ version = 4
278278
# location of the logging.conf file
279279
logging = /etc/st2/logging.sensorcontainer.conf
280280
# Provider of sensor node partition config.
281-
partition_provider = {'name': 'default'}
281+
partition_provider = name:default
282282
# name of the sensor node.
283283
sensor_node_name = sensornode1
284284
# Run in a single sensor mode where parent process exits when a sensor crashes / dies. This is useful in environments where partitioning, sensor process life cycle and failover is handled by a 3rd party service such as kubernetes.

contrib/core/__init__.py

Whitespace-only changes.

contrib/core/fixture.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2022 The StackStorm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
from st2tests import fixturesloader
15+
16+
PACK_NAME, PACK_PATH = fixturesloader.get_fixture_name_and_path(__file__)

contrib/core/tests/test_action_sendmail.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
from st2common.constants import action as action_constants
2727

28+
from st2tests.fixtures.packs.core.fixture import PACK_NAME
2829
from st2tests.fixturesloader import FixturesLoader
2930
from st2tests.base import RunnerTestCase
3031
from st2tests.base import CleanDbTestCase
@@ -38,6 +39,10 @@
3839
MOCK_EXECUTION.id = "598dbf0c0640fd54bffc688b"
3940
HOSTNAME = socket.gethostname()
4041

42+
# we need the core pack to also be in st2tests.fixtures so we can use FixturesLoader()
43+
# The PACK_NAME import tells pants to include that, so use the var here.
44+
FIXTURE_PACK = "packs/" + PACK_NAME
45+
4146

4247
class SendmailActionTestCase(RunnerTestCase, CleanDbTestCase, CleanFilesTestCase):
4348
"""
@@ -237,11 +242,11 @@ def _run_action(self, action_parameters):
237242
parse the output email data.
238243
"""
239244
models = self.fixtures_loader.load_models(
240-
fixtures_pack="packs/core", fixtures_dict={"actions": ["sendmail.yaml"]}
245+
fixtures_pack=FIXTURE_PACK, fixtures_dict={"actions": ["sendmail.yaml"]}
241246
)
242247
action_db = models["actions"]["sendmail.yaml"]
243248
entry_point = self.fixtures_loader.get_fixture_file_path_abs(
244-
"packs/core", "actions", "send_mail/send_mail"
249+
FIXTURE_PACK, "actions", "send_mail/send_mail"
245250
)
246251

247252
runner = self._get_runner(action_db, entry_point=entry_point)

contrib/packs/tests/__init__.py

Whitespace-only changes.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2022 The StackStorm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import os
15+
16+
FIXTURES_DIR = os.path.dirname(os.path.abspath(__file__))

contrib/packs/tests/test_action_download.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737

3838
from pack_mgmt.download import DownloadGitRepoAction
3939

40-
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
40+
# this import allows pants to detect that the fixtures are used in this file
41+
from .fixtures import FIXTURES_DIR
4142

4243
PACK_INDEX = {
4344
"test": {
@@ -639,7 +640,7 @@ def test_run_pack_dowload_local_git_repo_detached_head_state(self):
639640
side_effect=TypeError("detached head")
640641
)
641642

642-
pack_path = os.path.join(BASE_DIR, "fixtures/stackstorm-test")
643+
pack_path = os.path.join(FIXTURES_DIR, "stackstorm-test")
643644

644645
result = action.run(
645646
packs=["file://%s" % (pack_path)], abs_repo_base=self.repo_base
@@ -665,7 +666,7 @@ def test_run_pack_download_local_directory(self):
665666
)
666667

667668
# 2. Local pack which is not a git repository
668-
pack_path = os.path.join(BASE_DIR, "fixtures/stackstorm-test4")
669+
pack_path = os.path.join(FIXTURES_DIR, "stackstorm-test4")
669670

670671
result = action.run(
671672
packs=["file://%s" % (pack_path)], abs_repo_base=self.repo_base

contrib/runners/action_chain_runner/tests/unit/test_actionchain.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from st2common.util import action_db as action_db_util
3636
from st2common.exceptions.action import ParameterRenderingFailedException
3737
from st2tests import ExecutionDbTestCase
38+
from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK
3839
from st2tests.fixturesloader import FixturesLoader
3940

4041

@@ -45,8 +46,6 @@ def __init__(self, status=LIVEACTION_STATUS_SUCCEEDED, result=""):
4546
self.result = result
4647

4748

48-
FIXTURES_PACK = "generic"
49-
5049
TEST_MODELS = {
5150
"actions": ["a1.yaml", "a2.yaml", "action_4_action_context_param.yaml"],
5251
"runners": ["testrunner1.yaml"],

contrib/runners/action_chain_runner/tests/unit/test_actionchain_cancel.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
from st2common.transport.publishers import CUDPublisher
3636

3737
from st2tests import ExecutionDbTestCase
38-
from st2tests import fixturesloader
38+
from st2tests.fixtures.packs.action_chain_tests.fixture import (
39+
PACK_NAME as TEST_PACK,
40+
PACK_PATH as TEST_PACK_PATH,
41+
)
42+
from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH
3943
from st2tests.mocks.liveaction import MockLiveActionPublisherNonBlocking
4044
from six.moves import range
4145

@@ -45,10 +49,7 @@
4549
"actions": ["test_cancel.yaml", "test_cancel_with_subworkflow.yaml"],
4650
}
4751

48-
TEST_PACK = "action_chain_tests"
49-
TEST_PACK_PATH = fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK
50-
51-
PACKS = [TEST_PACK_PATH, fixturesloader.get_fixtures_packs_base_path() + "/core"]
52+
PACKS = [TEST_PACK_PATH, CORE_PACK_PATH]
5253

5354
USERNAME = "stanley"
5455

contrib/runners/action_chain_runner/tests/unit/test_actionchain_notifications.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
from st2common.transport.liveaction import LiveActionPublisher
3636
from st2common.transport.publishers import CUDPublisher
3737

38+
from st2tests.fixtures.generic.fixture import PACK_NAME as FIXTURES_PACK
39+
from st2tests.fixtures.packs.action_chain_tests.fixture import (
40+
PACK_NAME as TEST_PACK,
41+
PACK_PATH as TEST_PACK_PATH,
42+
)
43+
from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH
3844
from st2tests.mocks.liveaction import MockLiveActionPublisherNonBlocking
3945

4046

@@ -45,8 +51,6 @@ def __init__(self, status=action_constants.LIVEACTION_STATUS_SUCCEEDED, result="
4551
self.result = result
4652

4753

48-
FIXTURES_PACK = "generic"
49-
5054
TEST_MODELS = {"actions": ["a1.yaml", "a2.yaml"], "runners": ["testrunner1.yaml"]}
5155

5256
MODELS = fixturesloader.FixturesLoader().load_models(
@@ -60,10 +64,7 @@ def __init__(self, status=action_constants.LIVEACTION_STATUS_SUCCEEDED, result="
6064
FIXTURES_PACK, "actionchains", "chain_with_notifications.yaml"
6165
)
6266

63-
TEST_PACK = "action_chain_tests"
64-
TEST_PACK_PATH = fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK
65-
66-
PACKS = [TEST_PACK_PATH, fixturesloader.get_fixtures_packs_base_path() + "/core"]
67+
PACKS = [TEST_PACK_PATH, CORE_PACK_PATH]
6768

6869
MOCK_NOTIFY = {
6970
"on-complete": {

contrib/runners/action_chain_runner/tests/unit/test_actionchain_pause_resume.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
from st2common.util import date as date_utils
3838

3939
from st2tests import ExecutionDbTestCase
40-
from st2tests import fixturesloader
40+
from st2tests.fixtures.packs.action_chain_tests.fixture import (
41+
PACK_NAME as TEST_PACK,
42+
PACK_PATH as TEST_PACK_PATH,
43+
)
44+
from st2tests.fixtures.packs.core.fixture import PACK_PATH as CORE_PACK_PATH
4145
from st2tests.mocks.liveaction import MockLiveActionPublisherNonBlocking
4246
from six.moves import range
4347

@@ -67,10 +71,7 @@
6771
],
6872
}
6973

70-
TEST_PACK = "action_chain_tests"
71-
TEST_PACK_PATH = fixturesloader.get_fixtures_packs_base_path() + "/" + TEST_PACK
72-
73-
PACKS = [TEST_PACK_PATH, fixturesloader.get_fixtures_packs_base_path() + "/core"]
74+
PACKS = [TEST_PACK_PATH, CORE_PACK_PATH]
7475

7576
USERNAME = "stanley"
7677

0 commit comments

Comments
 (0)