Skip to content

Commit a54d552

Browse files
anara123reutshal
andauthored
remove old regexes from content (#7398)
* remove old regexes from content * use demisto-sdk from master * Update dev-requirements-py3.txt Co-authored-by: reut shalem <[email protected]> * Update dev-requirements-py3.txt * replace old regexes * sdk release 1-1-2 test * sdk release 1-1-2 test * sdk release 1-1-2 test * sdk release 1-1-2 Co-authored-by: reut shalem <[email protected]> Co-authored-by: rshalem <[email protected]>
1 parent 9df8ad4 commit a54d552

File tree

4 files changed

+22
-26
lines changed

4 files changed

+22
-26
lines changed

Tests/configure_and_test_integration_instances.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
from demisto_sdk.commands.common.tools import print_error, print_warning, print_color, LOG_COLORS, run_threads_list, \
1616
run_command, get_last_release_version, checked_type, get_yaml, str2bool, server_version_compare
1717
from demisto_sdk.commands.validate.file_validator import FilesValidator
18-
from demisto_sdk.commands.common.constants import YML_INTEGRATION_REGEXES, INTEGRATION_REGEX, PACKS_INTEGRATION_REGEX, \
19-
BETA_INTEGRATION_REGEX, RUN_ALL_TESTS_FORMAT
18+
from demisto_sdk.commands.common.constants import YML_INTEGRATION_REGEXES, RUN_ALL_TESTS_FORMAT
2019

2120
from Tests.test_integration import __get_integration_config, __test_integration_instance, \
2221
__disable_integrations_instances
2322
from Tests.test_content import load_conf_files, extract_filtered_tests, ParallelPrintsManager, \
2423
get_server_numeric_version
25-
2624
from Tests.update_content_data import update_content
2725
from Tests.Marketplace.search_and_install_packs import search_and_install_packs_and_their_dependencies
2826

@@ -198,7 +196,6 @@ def get_new_and_modified_integration_files(git_sha1):
198196
change_log = run_command('git diff --name-status {}'.format(git_sha1))
199197
modified_files, added_files, _, _ = file_validator.get_modified_files(change_log, tag)
200198
all_integration_regexes = YML_INTEGRATION_REGEXES
201-
all_integration_regexes.extend([INTEGRATION_REGEX, PACKS_INTEGRATION_REGEX, BETA_INTEGRATION_REGEX])
202199

203200
new_integration_files = [
204201
file_path for file_path in added_files if checked_type(file_path, all_integration_regexes)

Tests/scripts/collect_tests_and_content_packs.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Overview can be found at: https://confluence.paloaltonetworks.com/display/DemistoContent/Configure+Test+Filter
55
"""
66
import os
7-
import re
87
import sys
98
import json
109
import glob
@@ -34,18 +33,16 @@
3433

3534
TEST_DATA_INTEGRATION_YML_REGEX = r'Tests\/scripts\/infrastructure_tests\/tests_data\/mock_integrations\/.*\.yml'
3635
INTEGRATION_REGEXES = [
37-
INTEGRATION_REGEX,
38-
BETA_INTEGRATION_REGEX,
39-
PACKS_INTEGRATION_REGEX,
36+
PACKS_INTEGRATION_PY_REGEX,
37+
PACKS_INTEGRATION_PS_TEST_REGEX,
4038
TEST_DATA_INTEGRATION_YML_REGEX
4139
]
4240
TEST_DATA_SCRIPT_YML_REGEX = r'Tests/scripts/infrastructure_tests/tests_data/mock_scripts/.*.yml'
4341
SCRIPT_REGEXES = [
4442
TEST_DATA_SCRIPT_YML_REGEX
4543
]
4644
INCIDENT_FIELD_REGEXES = [
47-
INCIDENT_FIELD_REGEX,
48-
PACKS_INCIDENT_FIELDS_REGEX
45+
PACKS_INCIDENT_FIELD_JSON_REGEX
4946
]
5047
FILES_IN_SCRIPTS_OR_INTEGRATIONS_DIRS_REGEXES = [
5148
FILE_IN_INTEGRATIONS_DIR_REGEX,
@@ -55,20 +52,19 @@
5552
]
5653
CHECKED_TYPES_REGEXES = [
5754
# Integrations
58-
INTEGRATION_REGEX,
59-
INTEGRATION_YML_REGEX,
60-
BETA_INTEGRATION_REGEX,
61-
PACKS_INTEGRATION_REGEX,
55+
PACKS_INTEGRATION_PY_REGEX,
6256
PACKS_INTEGRATION_YML_REGEX,
57+
PACKS_INTEGRATION_NON_SPLIT_YML_REGEX,
58+
PACKS_INTEGRATION_PS_REGEX,
59+
6360
# Scripts
64-
SCRIPT_REGEX,
65-
SCRIPT_YML_REGEX,
6661
PACKS_SCRIPT_REGEX,
6762
PACKS_SCRIPT_YML_REGEX,
63+
PACKS_SCRIPT_NON_SPLIT_YML_REGEX,
64+
6865
# Playbooks
6966
PLAYBOOK_REGEX,
70-
BETA_PLAYBOOK_REGEX,
71-
PACKS_PLAYBOOK_YML_REGEX
67+
PLAYBOOK_YML_REGEX
7268
]
7369

7470
# File names
@@ -159,8 +155,7 @@ def get_modified_files(files_string):
159155
# reputations.json
160156
elif re.match(INDICATOR_TYPES_REPUTATIONS_REGEX, file_path, re.IGNORECASE) or \
161157
re.match(PACKS_INDICATOR_TYPES_REPUTATIONS_REGEX, file_path, re.IGNORECASE) or \
162-
re.match(INDICATOR_TYPES_REGEX, file_path, re.IGNORECASE) or \
163-
re.match(PACKS_INDICATOR_TYPES_REGEX, file_path, re.IGNORECASE):
158+
re.match(PACKS_INDICATOR_TYPE_JSON_REGEX, file_path, re.IGNORECASE):
164159
is_reputations_json = True
165160

166161
elif checked_type(file_path, INCIDENT_FIELD_REGEXES):
@@ -870,7 +865,7 @@ def get_test_conf_from_conf(test_id, server_version, conf=None):
870865
# return None if nothing is found
871866
test_conf = next((test_conf for test_conf in test_conf_lst if (
872867
test_conf.get('playbookID') == test_id
873-
and is_runnable_in_server_version(from_v=test_conf.get('fromversion', '0'),
868+
and is_runnable_in_server_version(from_v=test_conf.get('fromversion', '0.0'),
874869
server_v=server_version,
875870
to_v=test_conf.get('toversion', '99.99.99'))
876871
)), None)
@@ -894,7 +889,7 @@ def extract_matching_object_from_id_set(obj_id, obj_set, server_version='0'):
894889
continue
895890

896891
# check if object is runnable
897-
fromversion = obj.get('fromversion', '0')
892+
fromversion = obj.get('fromversion', '0.0')
898893
toversion = obj.get('toversion', '99.99.99')
899894
if is_runnable_in_server_version(from_v=fromversion, server_v=server_version, to_v=toversion):
900895
return obj
@@ -962,7 +957,7 @@ def is_test_runnable(test_id, id_set, conf, server_version):
962957
if not test_conf:
963958
print_warning(f'{warning_prefix} - couldn\'t find test in conf.json')
964959
return False
965-
conf_fromversion = test_conf.get('fromversion', '0')
960+
conf_fromversion = test_conf.get('fromversion', '0.0')
966961
conf_toversion = test_conf.get('toversion', '99.99.99')
967962
test_playbooks_set = id_set.get('TestPlaybooks', [])
968963
test_playbook_obj = extract_matching_object_from_id_set(test_id, test_playbooks_set, server_version)

Tests/scripts/validate.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
if [ "${CHECK_BACKWARD}" = "true" ] ;
4+
if [[ $CIRCLE_BRANCH = master ]];
5+
then
6+
demisto-sdk validate -a
7+
8+
elif [ "${CHECK_BACKWARD}" = "true" ] ;
59
then
610
demisto-sdk validate -g --post-commit
711

dev-requirements-py3.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
flake8==3.7.9
22
bandit==1.6.2
33
demisto-py==2.0.11
4-
demisto-sdk==1.1.1
4+
demisto-sdk==1.1.2
55
pytest==5.2.1
66
pytest-mock==1.11.1
77
requests-mock==1.7.0
@@ -14,4 +14,4 @@ beautifulsoup4==4.8.1
1414
pypdf2==1.26.0
1515
freezegun==0.3.12
1616
vulture==1.5
17-
git+https://github.com/coyo8/parinx.git@6493798ceba8089345d970f71be4a896eb6b081d
17+
git+https://github.com/coyo8/parinx.git@6493798ceba8089345d970f71be4a896eb6b081d

0 commit comments

Comments
 (0)