Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] feat: reuse specs finder #1433

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ jobs:
name: Get specs array
run: |
cd spec-detect
source ./test_finder.sh
result="["
## split CI_Groups into array
IFS="," read -a groups <<< "${{ env.CI_GROUPS }}"
for group in "${groups[@]}"; do
item="{\"ciGroup\": \"${group}\", \"specs\": "
IFS="," read -a SPEC_ARRAY <<< "$(npm run -s osd:ciGroup${group})"
FORMATTED_SPEC="\""
for i in "${SPEC_ARRAY[@]}"; do
FORMATTED_SPEC+="cypress/integration/core-opensearch-dashboards/opensearch-dashboards/${i},"
done
FORMATTED_SPEC+="\" }"
specs_of_ci_group=`ci_grouped_specs_finder ${group}`
FORMATTED_SPEC="\"${specs_of_ci_group}\" }"
if [[ "${result}" != "[" ]];
then
result+=","
Expand Down
30 changes: 29 additions & 1 deletion test_finder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ OSD_BUILD_MANIFEST='../local-test-cluster/opensearch-dashboards-*/manifest.yml'
OSD_TEST_PATH='cypress/integration/core-opensearch-dashboards'
OSD_PLUGIN_TEST_PATH='cypress/integration/plugins'
TEST_TYPE=$OPTION
CI_GROUP_PATTERN_PREFIX="OpenSearch-Dashboards-ci-group-"

# Map component name in opensearch-build repo INPUT_MANIFEST with folder name for tests in functional repo
OSD_COMPONENT_TEST_MAP=( "OpenSearch-Dashboards:opensearch-dashboards"
Expand All @@ -23,6 +24,15 @@ OSD_COMPONENT_TEST_MAP=( "OpenSearch-Dashboards:opensearch-dashboards"
"mlCommonsDashboards:ml-commons-dashboards"
"securityAnalyticsDashboards:security-analytics-dashboards-plugin"
"assistantDashboards:dashboards-assistant"
"OpenSearch-Dashboards-ci-group-1:OpenSearch-Dashboards-ci-group-1"
"OpenSearch-Dashboards-ci-group-2:OpenSearch-Dashboards-ci-group-2"
"OpenSearch-Dashboards-ci-group-3:OpenSearch-Dashboards-ci-group-3"
"OpenSearch-Dashboards-ci-group-4:OpenSearch-Dashboards-ci-group-4"
"OpenSearch-Dashboards-ci-group-5:OpenSearch-Dashboards-ci-group-5"
"OpenSearch-Dashboards-ci-group-6:OpenSearch-Dashboards-ci-group-6"
"OpenSearch-Dashboards-ci-group-7:OpenSearch-Dashboards-ci-group-7"
"OpenSearch-Dashboards-ci-group-8:OpenSearch-Dashboards-ci-group-8"
"OpenSearch-Dashboards-ci-group-9:OpenSearch-Dashboards-ci-group-9"
)

if [ -z $TEST_TYPE ]; then
Expand Down Expand Up @@ -71,7 +81,13 @@ function get_test_list() {
else
for test_component in $TEST_COMPONENTS_LOCAL; do
if [ "$test_component" = "$component_name" ]; then
TEST_FILES_LOCAL+="$TEST_PATH_LOCAL/$test_folder/$TEST_FILES_EXT_LOCAL,"
ci_group_pattern="${CI_GROUP_PATTERN_PREFIX}*"
if [[ $test_component == $ci_group_pattern ]]; then
group=${test_component#${CI_GROUP_PATTERN_PREFIX}}
TEST_FILES_LOCAL=`ci_grouped_specs_finder ${group}`
else
TEST_FILES_LOCAL+="$TEST_PATH_LOCAL/$test_folder/$TEST_FILES_EXT_LOCAL,"
fi
break
fi
done
Expand All @@ -87,3 +103,15 @@ function get_test_list() {

echo "${TEST_FILES_LOCAL%,}"
}

function ci_grouped_specs_finder {
group=$1

IFS="," read -a SPEC_ARRAY <<< "$(npm run -s osd:ciGroup${group})"
FORMATTED_SPEC=""
for i in "${SPEC_ARRAY[@]}"; do
FORMATTED_SPEC+="${OSD_TEST_PATH}/opensearch-dashboards/${i},"
done

echo "${FORMATTED_SPEC}"
}
Loading