Skip to content

Commit b17e01c

Browse files
authored
Revert component-based scripts lookup (opensearch-project#3540)
Signed-off-by: Junqiu Lei <[email protected]>
1 parent 4722a0f commit b17e01c

File tree

6 files changed

+0
-57
lines changed

6 files changed

+0
-57
lines changed

src/paths/script_finder.py

-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def __init__(self, kind: str, paths: List[str]) -> None:
2626
For build.sh and integtest.sh scripts, given a component name and a checked-out Git repository,
2727
it will look in the following locations, in order:
2828
* <component_scripts_path>/<component_name>/<script-name>
29-
* /<component_name>/<script-name> in the component's Git repository
3029
* root of the component's Git repository
3130
* /scripts/<script-name> in the component's Git repository
3231
* <default_scripts_path>/<script-name>
@@ -49,7 +48,6 @@ def __find_script(cls, name: str, paths: List[str]) -> str:
4948
def __find_named_script(cls, script_name: str, component_name: str, git_dir: str) -> str:
5049
paths = [
5150
os.path.realpath(os.path.join(cls.component_scripts_path, component_name, script_name)),
52-
os.path.realpath(os.path.join(git_dir, component_name, script_name)),
5351
os.path.realpath(os.path.join(git_dir, script_name)),
5452
os.path.realpath(os.path.join(git_dir, "scripts", script_name)),
5553
os.path.realpath(os.path.join(cls.default_scripts_path, script_name)),
@@ -61,7 +59,6 @@ def __find_named_script(cls, script_name: str, component_name: str, git_dir: str
6159
def find_build_script(cls, project: str, component_name: str, git_dir: str) -> str:
6260
paths = [
6361
os.path.realpath(os.path.join(cls.component_scripts_path, component_name, "build.sh")),
64-
os.path.realpath(os.path.join(git_dir, component_name, "build.sh")),
6562
os.path.realpath(os.path.join(git_dir, "build.sh")),
6663
os.path.realpath(os.path.join(git_dir, "scripts", "build.sh")),
6764
os.path.realpath(

tests/tests_paths/data/git/component_with_scripts_in_component_folder/Component/build.sh

-8
This file was deleted.

tests/tests_paths/data/git/component_with_scripts_in_component_folder/Component/bwctest.sh

-8
This file was deleted.

tests/tests_paths/data/git/component_with_scripts_in_component_folder/Component/install.sh

-8
This file was deleted.

tests/tests_paths/data/git/component_with_scripts_in_component_folder/Component/integtest.sh

-8
This file was deleted.

tests/tests_paths/test_script_finder.py

-22
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def setUp(self) -> None:
2020
self.component_with_scripts = os.path.join(self.data_path, "git", "component-with-scripts")
2121
self.component_with_scripts_folder = os.path.join(self.data_path, "git", "component-with-scripts-folder")
2222
self.component_without_scripts = os.path.join(self.data_path, "git", "component-without-scripts")
23-
self.component_with_scripts_in_component_folder = os.path.join(self.data_path, "git", "component_with_scripts_in_component_folder")
2423

2524
# find_build_script
2625

@@ -66,13 +65,6 @@ def test_find_build_script_component_script_in_folder_with_default(self) -> None
6665
msg="A component with a scripts folder resolves to the override.",
6766
)
6867

69-
def test_find_build_script_component_script_in_component_folder(self) -> None:
70-
self.assertEqual(
71-
os.path.join(self.component_with_scripts_in_component_folder, "Component", "build.sh"),
72-
ScriptFinder.find_build_script("Component", "Component", self.component_with_scripts_in_component_folder),
73-
msg="A component with a script in component folder resolves to the override.",
74-
)
75-
7668
@patch("os.path.exists", return_value=False)
7769
def test_find_build_script_does_not_exist(self, *mocks: MagicMock) -> None:
7870
with self.assertRaisesRegex(
@@ -118,13 +110,6 @@ def test_find_integ_test_script_component_script_in_folder_with_default(self) ->
118110
msg="A component with a scripts folder resolves to a script in that folder.",
119111
)
120112

121-
def test_find_integ_test_script_component_script_in_component_folder(self) -> None:
122-
self.assertEqual(
123-
os.path.join(self.component_with_scripts_in_component_folder, "Component", "integtest.sh"),
124-
ScriptFinder.find_integ_test_script("Component", self.component_with_scripts_in_component_folder),
125-
msg="A component with a script in component folder resolves to the override.",
126-
)
127-
128113
@patch("os.path.exists", return_value=False)
129114
def test_find_integ_test_script_does_not_exist(self, *mocks: MagicMock) -> None:
130115
with self.assertRaisesRegex(
@@ -194,13 +179,6 @@ def test_find_bwc_test_script_component_script_in_folder_with_default(self) -> N
194179
msg="A component with a scripts folder resolves to a script in that folder.",
195180
)
196181

197-
def test_find_bwc_test_script_component_script_in_component_folder(self) -> None:
198-
self.assertEqual(
199-
os.path.join(ScriptFinder.default_scripts_path, "bwctest.sh"),
200-
ScriptFinder.find_bwc_test_script("Component", self.component_with_scripts_in_component_folder),
201-
msg="A component with a script in component folder resolves to the override.",
202-
)
203-
204182
@patch("os.path.exists", return_value=False)
205183
def test_find_bwc_test_script_does_not_exist(self, *mocks: MagicMock) -> None:
206184
with self.assertRaisesRegex(

0 commit comments

Comments
 (0)