prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Remove `integtest.sh` from all plugin repos
  The [integtest.sh](https://github.com/opensearch-project/opensearch-build/blob/main/bundle-workflow/scripts/default/integtest.sh) tool contains the logic to run integration tests for a plugin. This logic is mostly common across most plugins, so it has been moved to `opensearch-build` repo. Thus it can be removed from the individual plugin repos.
  However, if a plugin requires some custom logic to run integtests, which the standard tool doesn't provide, they can continue maintaining this integtest.sh in their own repo. In this case, when the integration tests are run, if a plugin has a integtest.sh tool in their repo, it gets precedence over the standard default integtest.sh in the `opensearch-build` repo. This precedence order logic is defined in ScriptFinder [here](https://github.com/opensearch-project/opensearch-build/blob/84f2fa1cf15abe314aee62dbd2cb39bf2c9bb65f/bundle-workflow/src/paths/script_finder.py#L65) 
  
  Action items:
  
  Raise PRs on all plugin repos and remove integtest.sh 
  - [ ] index-management
  - [ ] anomaly-detection,
  - [ ] alerting
  - [ ] asynchronous-search
  - [ ] k-NN
  
  Changes will need to be backported into 1.x branches if such exist, too.
  
  --- 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 
  89     @classmethod
  90     def find_bwc_test_script(cls, component_name, git_dir):
  91         paths = [
  92             os.path.realpath(os.path.join(git_dir, "bwctest.sh")),
  93             os.path.realpath(os.path.join(git_dir, "scripts/bwctest.sh")),
  94             os.path.realpath(
  95                 os.path.join(cls.component_scripts_path, component_name, "bwctest.sh")
  96             ),
  97             os.path.realpath(os.path.join(cls.default_scripts_path, "bwctest.sh")),
  98         ]
  99 
  100         return cls.__find_script("bwctest.sh", paths)
  101
  ```
  --- 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
  @@ -64,9 +64,8 @@
       @classmethod
       def find_integ_test_script(cls, component_name, git_dir):
           paths = [
  -            # TODO: Uncomment this after the integtest.sh tool is removed from plugin repos. See issue #497
  -            # os.path.realpath(os.path.join(git_dir, "integtest.sh")),
  -            # os.path.realpath(os.path.join(git_dir, "scripts/integtest.sh")),
  +            os.path.realpath(os.path.join(git_dir, "integtest.sh")),
  +            os.path.realpath(os.path.join(git_dir, "scripts/integtest.sh")),
               os.path.realpath(
                   os.path.join(cls.component_scripts_path, component_name, "integtest.sh")
               ),
  
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@@ -64,9 +64,8 @@\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(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", "issue": "Remove `integtest.sh` from all plugin repos\nThe [integtest.sh](https://github.com/opensearch-project/opensearch-build/blob/main/bundle-workflow/scripts/default/integtest.sh) tool contains the logic to run integration tests for a plugin. This logic is mostly common across most plugins, so it has been moved to `opensearch-build` repo. Thus it can be removed from the individual plugin repos.\r\nHowever, if a plugin requires some custom logic to run integtests, which the standard tool doesn't provide, they can continue maintaining this integtest.sh in their own repo. In this case, when the integration tests are run, if a plugin has a integtest.sh tool in their repo, it gets precedence over the standard default integtest.sh in the `opensearch-build` repo. This precedence order logic is defined in ScriptFinder [here](https://github.com/opensearch-project/opensearch-build/blob/84f2fa1cf15abe314aee62dbd2cb39bf2c9bb65f/bundle-workflow/src/paths/script_finder.py#L65) \r\n\r\nAction items:\r\n\r\nRaise PRs on all plugin repos and remove integtest.sh \r\n- [ ] index-management\r\n- [ ] anomaly-detection,\r\n- [ ] alerting\r\n- [ ] asynchronous-search\r\n- [ ] k-NN\r\n\r\nChanges will need to be backported into 1.x branches if such exist, too.\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\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"}], "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            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"}]}