prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add bwctest.sh in OpenSearch and one plugin
  - [x] OpenSearch Core - https://github.com/opensearch-project/OpenSearch/pull/1150
  - [x] Anomaly Detection Plugin - https://github.com/opensearch-project/anomaly-detection/pull/189
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bundle-workflow/src/paths/script_finder.py`
  Content:
  ```
  1 # SPDX-License-Identifier: Apache-2.0
  2 #
  3 # The OpenSearch Contributors require contributions made to
  4 # this file be licensed under the Apache-2.0 license or a
  5 # compatible open source license.
  6 
  7 import os
  8 
  9 
  10 class ScriptFinder:
  11     class ScriptNotFoundError(Exception):
  12         def __init__(self, kind, paths):
  13             self.kind = kind
  14             self.paths = paths
  15             super().__init__(f"Could not find {kind} script. Looked in {paths}.")
  16 
  17     component_scripts_path = os.path.realpath(
  18         os.path.join(
  19             os.path.dirname(os.path.abspath(__file__)), "../../scripts/components"
  20         )
  21     )
  22 
  23     default_scripts_path = os.path.realpath(
  24         os.path.join(
  25             os.path.dirname(os.path.abspath(__file__)), "../../scripts/default"
  26         )
  27     )
  28 
  29     """
  30     ScriptFinder is a helper that abstracts away the details of where to look for build, test and install scripts.
  31 
  32     For build.sh and integtest.sh scripts, given a component name and a checked-out Git repository,
  33     it will look in the following locations, in order:
  34       * Root of the Git repository
  35       * /scripts/<script-name> in the Git repository
  36       * <component_scripts_path>/<component_name>/<script-name>
  37       * <default_scripts_path>/<script-name>
  38 
  39     For install.sh scripts, given a component name, it will look in the following locations, in order:
  40       * <component_scripts_path>/<component_name>/<script-name>
  41       * <default_scripts_path>/<script-name>
  42     """
  43 
  44     @classmethod
  45     def __find_script(cls, name, paths):
  46         script = next(filter(lambda path: os.path.exists(path), paths), None)
  47         if script is None:
  48             raise ScriptFinder.ScriptNotFoundError(name, paths)
  49         return script
  50 
  51     @classmethod
  52     def find_build_script(cls, component_name, git_dir):
  53         paths = [
  54             os.path.realpath(os.path.join(git_dir, "build.sh")),
  55             os.path.realpath(os.path.join(git_dir, "scripts/build.sh")),
  56             os.path.realpath(
  57                 os.path.join(cls.component_scripts_path, component_name, "build.sh")
  58             ),
  59             os.path.realpath(os.path.join(cls.default_scripts_path, "build.sh")),
  60         ]
  61 
  62         return cls.__find_script("build.sh", paths)
  63 
  64     @classmethod
  65     def find_integ_test_script(cls, component_name, git_dir):
  66         paths = [
  67             # TODO: Uncomment this after the integtest.sh tool is removed from plugin repos. See issue #497
  68             # os.path.realpath(os.path.join(git_dir, "integtest.sh")),
  69             # os.path.realpath(os.path.join(git_dir, "scripts/integtest.sh")),
  70             os.path.realpath(
  71                 os.path.join(cls.component_scripts_path, component_name, "integtest.sh")
  72             ),
  73             os.path.realpath(os.path.join(cls.default_scripts_path, "integtest.sh")),
  74         ]
  75 
  76         return cls.__find_script("integtest.sh", paths)
  77 
  78     @classmethod
  79     def find_install_script(cls, component_name):
  80         paths = [
  81             os.path.realpath(
  82                 os.path.join(cls.component_scripts_path, component_name, "install.sh")
  83             ),
  84             os.path.realpath(os.path.join(cls.default_scripts_path, "install.sh")),
  85         ]
  86 
  87         return cls.__find_script("install.sh", paths)
  88
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/bundle-workflow/src/paths/script_finder.py b/bundle-workflow/src/paths/script_finder.py
  --- a/bundle-workflow/src/paths/script_finder.py
  +++ b/bundle-workflow/src/paths/script_finder.py
  @@ -85,3 +85,16 @@
           ]
   
           return cls.__find_script("install.sh", paths)
  +
  +    @classmethod
  +    def find_bwc_test_script(cls, component_name, git_dir):
  +        paths = [
  +            os.path.realpath(os.path.join(git_dir, "bwctest.sh")),
  +            os.path.realpath(os.path.join(git_dir, "scripts/bwctest.sh")),
  +            os.path.realpath(
  +                os.path.join(cls.component_scripts_path, component_name, "bwctest.sh")
  +            ),
  +            os.path.realpath(os.path.join(cls.default_scripts_path, "bwctest.sh")),
  +        ]
  +
  +        return cls.__find_script("bwctest.sh", paths)
  
verification_info: {"golden_diff": "diff --git a/bundle-workflow/src/paths/script_finder.py b/bundle-workflow/src/paths/script_finder.py\n--- a/bundle-workflow/src/paths/script_finder.py\n+++ b/bundle-workflow/src/paths/script_finder.py\n@@ -85,3 +85,16 @@\n         ]\n \n         return cls.__find_script(\"install.sh\", paths)\n+\n+    @classmethod\n+    def find_bwc_test_script(cls, component_name, git_dir):\n+        paths = [\n+            os.path.realpath(os.path.join(git_dir, \"bwctest.sh\")),\n+            os.path.realpath(os.path.join(git_dir, \"scripts/bwctest.sh\")),\n+            os.path.realpath(\n+                os.path.join(cls.component_scripts_path, component_name, \"bwctest.sh\")\n+            ),\n+            os.path.realpath(os.path.join(cls.default_scripts_path, \"bwctest.sh\")),\n+        ]\n+\n+        return cls.__find_script(\"bwctest.sh\", paths)\n", "issue": "Add bwctest.sh in OpenSearch and one plugin\n- [x] OpenSearch Core - https://github.com/opensearch-project/OpenSearch/pull/1150\r\n- [x] Anomaly Detection Plugin - https://github.com/opensearch-project/anomaly-detection/pull/189\n", "before_files": [{"content": "# SPDX-License-Identifier: Apache-2.0\n#\n# The OpenSearch Contributors require contributions made to\n# this file be licensed under the Apache-2.0 license or a\n# compatible open source license.\n\nimport os\n\n\nclass ScriptFinder:\n    class ScriptNotFoundError(Exception):\n        def __init__(self, kind, paths):\n            self.kind = kind\n            self.paths = paths\n            super().__init__(f\"Could not find {kind} script. Looked in {paths}.\")\n\n    component_scripts_path = os.path.realpath(\n        os.path.join(\n            os.path.dirname(os.path.abspath(__file__)), \"../../scripts/components\"\n        )\n    )\n\n    default_scripts_path = os.path.realpath(\n        os.path.join(\n            os.path.dirname(os.path.abspath(__file__)), \"../../scripts/default\"\n        )\n    )\n\n    \"\"\"\n    ScriptFinder is a helper that abstracts away the details of where to look for build, test and install scripts.\n\n    For build.sh and integtest.sh scripts, given a component name and a checked-out Git repository,\n    it will look in the following locations, in order:\n      * Root of the Git repository\n      * /scripts/<script-name> in the Git repository\n      * <component_scripts_path>/<component_name>/<script-name>\n      * <default_scripts_path>/<script-name>\n\n    For install.sh scripts, given a component name, it will look in the following locations, in order:\n      * <component_scripts_path>/<component_name>/<script-name>\n      * <default_scripts_path>/<script-name>\n    \"\"\"\n\n    @classmethod\n    def __find_script(cls, name, paths):\n        script = next(filter(lambda path: os.path.exists(path), paths), None)\n        if script is None:\n            raise ScriptFinder.ScriptNotFoundError(name, paths)\n        return script\n\n    @classmethod\n    def find_build_script(cls, component_name, git_dir):\n        paths = [\n            os.path.realpath(os.path.join(git_dir, \"build.sh\")),\n            os.path.realpath(os.path.join(git_dir, \"scripts/build.sh\")),\n            os.path.realpath(\n                os.path.join(cls.component_scripts_path, component_name, \"build.sh\")\n            ),\n            os.path.realpath(os.path.join(cls.default_scripts_path, \"build.sh\")),\n        ]\n\n        return cls.__find_script(\"build.sh\", paths)\n\n    @classmethod\n    def find_integ_test_script(cls, component_name, git_dir):\n        paths = [\n            # TODO: Uncomment this after the integtest.sh tool is removed from plugin repos. See issue #497\n            # os.path.realpath(os.path.join(git_dir, \"integtest.sh\")),\n            # os.path.realpath(os.path.join(git_dir, \"scripts/integtest.sh\")),\n            os.path.realpath(\n                os.path.join(cls.component_scripts_path, component_name, \"integtest.sh\")\n            ),\n            os.path.realpath(os.path.join(cls.default_scripts_path, \"integtest.sh\")),\n        ]\n\n        return cls.__find_script(\"integtest.sh\", paths)\n\n    @classmethod\n    def find_install_script(cls, component_name):\n        paths = [\n            os.path.realpath(\n                os.path.join(cls.component_scripts_path, component_name, \"install.sh\")\n            ),\n            os.path.realpath(os.path.join(cls.default_scripts_path, \"install.sh\")),\n        ]\n\n        return cls.__find_script(\"install.sh\", paths)\n", "path": "bundle-workflow/src/paths/script_finder.py"}], "after_files": [{"content": "# SPDX-License-Identifier: Apache-2.0\n#\n# The OpenSearch Contributors require contributions made to\n# this file be licensed under the Apache-2.0 license or a\n# compatible open source license.\n\nimport os\n\n\nclass ScriptFinder:\n    class ScriptNotFoundError(Exception):\n        def __init__(self, kind, paths):\n            self.kind = kind\n            self.paths = paths\n            super().__init__(f\"Could not find {kind} script. Looked in {paths}.\")\n\n    component_scripts_path = os.path.realpath(\n        os.path.join(\n            os.path.dirname(os.path.abspath(__file__)), \"../../scripts/components\"\n        )\n    )\n\n    default_scripts_path = os.path.realpath(\n        os.path.join(\n            os.path.dirname(os.path.abspath(__file__)), \"../../scripts/default\"\n        )\n    )\n\n    \"\"\"\n    ScriptFinder is a helper that abstracts away the details of where to look for build, test and install scripts.\n\n    For build.sh and integtest.sh scripts, given a component name and a checked-out Git repository,\n    it will look in the following locations, in order:\n      * Root of the Git repository\n      * /scripts/<script-name> in the Git repository\n      * <component_scripts_path>/<component_name>/<script-name>\n      * <default_scripts_path>/<script-name>\n\n    For install.sh scripts, given a component name, it will look in the following locations, in order:\n      * <component_scripts_path>/<component_name>/<script-name>\n      * <default_scripts_path>/<script-name>\n    \"\"\"\n\n    @classmethod\n    def __find_script(cls, name, paths):\n        script = next(filter(lambda path: os.path.exists(path), paths), None)\n        if script is None:\n            raise ScriptFinder.ScriptNotFoundError(name, paths)\n        return script\n\n    @classmethod\n    def find_build_script(cls, component_name, git_dir):\n        paths = [\n            os.path.realpath(os.path.join(git_dir, \"build.sh\")),\n            os.path.realpath(os.path.join(git_dir, \"scripts/build.sh\")),\n            os.path.realpath(\n                os.path.join(cls.component_scripts_path, component_name, \"build.sh\")\n            ),\n            os.path.realpath(os.path.join(cls.default_scripts_path, \"build.sh\")),\n        ]\n\n        return cls.__find_script(\"build.sh\", paths)\n\n    @classmethod\n    def find_integ_test_script(cls, component_name, git_dir):\n        paths = [\n            # TODO: Uncomment this after the integtest.sh tool is removed from plugin repos. See issue #497\n            # os.path.realpath(os.path.join(git_dir, \"integtest.sh\")),\n            # os.path.realpath(os.path.join(git_dir, \"scripts/integtest.sh\")),\n            os.path.realpath(\n                os.path.join(cls.component_scripts_path, component_name, \"integtest.sh\")\n            ),\n            os.path.realpath(os.path.join(cls.default_scripts_path, \"integtest.sh\")),\n        ]\n\n        return cls.__find_script(\"integtest.sh\", paths)\n\n    @classmethod\n    def find_install_script(cls, component_name):\n        paths = [\n            os.path.realpath(\n                os.path.join(cls.component_scripts_path, component_name, \"install.sh\")\n            ),\n            os.path.realpath(os.path.join(cls.default_scripts_path, \"install.sh\")),\n        ]\n\n        return cls.__find_script(\"install.sh\", paths)\n\n    @classmethod\n    def find_bwc_test_script(cls, component_name, git_dir):\n        paths = [\n            os.path.realpath(os.path.join(git_dir, \"bwctest.sh\")),\n            os.path.realpath(os.path.join(git_dir, \"scripts/bwctest.sh\")),\n            os.path.realpath(\n                os.path.join(cls.component_scripts_path, component_name, \"bwctest.sh\")\n            ),\n            os.path.realpath(os.path.join(cls.default_scripts_path, \"bwctest.sh\")),\n        ]\n\n        return cls.__find_script(\"bwctest.sh\", paths)\n", "path": "bundle-workflow/src/paths/script_finder.py"}]}