Skip to content

Commit 6db172d

Browse files
committed
Fix tests on Windows.
Signed-off-by: dblock <[email protected]>
1 parent d427476 commit 6db172d

File tree

62 files changed

+405
-259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+405
-259
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
os:
1818
- ubuntu-latest
1919
- macos-latest
20+
- windows-latest
2021
runs-on: ${{ matrix.os }}
2122
env:
2223
PYTHON_VERSION: 3.7

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ out.txt
1616

1717
/artifacts/
1818
/bundle/
19+
20+
/.vscode/

DEVELOPER_GUIDE.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Fork this repository on GitHub, and clone locally with `git clone`.
2424

2525
#### Pyenv
2626

27-
Use pyenv to manage multiple versions of Python. This can be installed with [pyenv-installer](https://github.com/pyenv/pyenv-installer).
27+
Use pyenv to manage multiple versions of Python. This can be installed with [pyenv-installer](https://github.com/pyenv/pyenv-installer) on Linux and MacOS, and [pyenv-win](https://github.com/pyenv-win/pyenv-win#installation) on Windows.
2828

2929
```
3030
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
@@ -42,7 +42,7 @@ Python 3.7.11
4242
If you are using pyenv.
4343

4444
```
45-
pyenv install 3.7.12
45+
pyenv install 3.7.12 # use 3.7.9 on Windows, the latest at the time of writing this
4646
pyenv global 3.7.12
4747
```
4848

@@ -57,7 +57,10 @@ $ pipenv --version
5757
pipenv, version 19.0
5858
```
5959

60+
On Windows, run `pyenv rehash` if `pipenv` cannot be found. This rehashes pyenv shims, creating a `pipenv` file in `/.pyenv/pyenv-win/shims/`.
61+
6062
#### NVM and Node
63+
6164
Install [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) to use the Node 10.24.1 version as it is required
6265

6366
```
@@ -66,6 +69,7 @@ nvm install v10.24.1
6669
```
6770

6871
#### Yarn
72+
6973
[Yarn](https://classic.yarnpkg.com/en/docs/install) is required for building and running the OpenSearch Dashboards and plugins
7074

7175
```

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ sortedcontainers = "*"
2323
cerberus = "~=1.3.4"
2424
psutil = "~=5.8"
2525
semantic-version = "~=2.8.5"
26+
atomicwrites = "*"
2627

2728
[dev-packages]
2829

Pipfile.lock

Lines changed: 60 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assemble_workflow/bundle_opensearch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
class BundleOpenSearch(Bundle):
1313
def install_plugin(self, plugin):
1414
tmp_path = self._copy_component(plugin, "plugins")
15-
cli_path = os.path.join(self.archive_path, "bin/opensearch-plugin")
15+
cli_path = os.path.join(self.archive_path, "bin", "opensearch-plugin")
1616
self._execute(f"{cli_path} install --batch file:{tmp_path}")
1717
super().install_plugin(plugin)

src/assemble_workflow/bundle_opensearch_dashboards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
class BundleOpenSearchDashboards(Bundle):
1313
def install_plugin(self, plugin):
1414
tmp_path = self._copy_component(plugin, "plugins")
15-
cli_path = os.path.join(self.archive_path, "bin/opensearch-dashboards-plugin")
15+
cli_path = os.path.join(self.archive_path, "bin", "opensearch-dashboards-plugin")
1616
self._execute(f"{cli_path} --allow-root install file:{tmp_path}")
1717
super().install_plugin(plugin)

src/build_workflow/build_args.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import logging
9+
import os
910
import sys
1011

1112

@@ -48,7 +49,7 @@ def __init__(self):
4849
self.snapshot = args.snapshot
4950
self.component = args.component
5051
self.keep = args.keep
51-
self.script_path = sys.argv[0].replace("/src/run_build.py", "/build.sh")
52+
self.script_path = sys.argv[0].replace(os.path.sep + os.path.join("src", "run_build.py"), f"{os.path.sep}build.sh")
5253

5354
def component_command(self, name):
5455
return " ".join(

src/ci_workflow/ci_args.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import logging
9+
import os
910
import sys
1011

1112

@@ -45,7 +46,7 @@ def __init__(self):
4546
self.component = args.component
4647
self.keep = args.keep
4748
self.logging_level = args.logging_level
48-
self.script_path = sys.argv[0].replace("/src/run_ci.py", "/ci.sh")
49+
self.script_path = sys.argv[0].replace(os.path.sep + os.path.join("src", "run_ci.py"), f"{os.path.sep}ci.sh")
4950

5051
def component_command(self, name):
5152
return " ".join(

src/git/git_repository.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ def __init__(self, url, ref, directory=None, working_subdirectory=None):
2929
self.temp_dir = None
3030
self.dir = directory
3131
os.makedirs(self.dir, exist_ok=False)
32-
3332
self.working_subdirectory = working_subdirectory
3433
self.__checkout__()
3534

35+
def __enter__(self):
36+
return self
37+
38+
def __exit__(self, exc_type, exc_value, exc_traceback):
39+
if self.temp_dir:
40+
self.temp_dir.__exit__(exc_type, exc_value, exc_traceback)
41+
3642
def __checkout__(self):
3743
# Check out the repository
3844
self.execute_silent("git init", self.dir)
@@ -42,13 +48,6 @@ def __checkout__(self):
4248
self.sha = self.output("git rev-parse HEAD", self.dir)
4349
logging.info(f"Checked out {self.url}@{self.ref} into {self.dir} at {self.sha}")
4450

45-
def __enter__(self):
46-
return self
47-
48-
def __exit__(self, exc_type, exc_value, exc_traceback):
49-
if self.temp_dir:
50-
self.temp_dir.__exit__(exc_type, exc_value, exc_traceback)
51-
5251
@property
5352
def working_directory(self):
5453
if self.working_subdirectory:

src/manifests/build_manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
build:
2020
name: string
2121
version: string
22-
platform: linux or darwin
22+
platform: linux, darwin or windows
2323
architecture: x64 or arm64
2424
components:
2525
- name: string

src/manifests/bundle_manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BundleManifest(Manifest):
2121
build:
2222
name: string
2323
version: string
24-
platform: linux or darwin
24+
platform: linux, darwin or windows
2525
architecture: x64 or arm64
2626
location: /relative/path/to/tarball
2727
components:

src/manifests/input_manifests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ class InputManifests(Manifests):
1616
def __init__(self):
1717
files = glob.glob(os.path.join(self.manifests_path, "**/opensearch-*.yml"))
1818
# there's an opensearch-1.0.0-maven.yml that we want to skip
19-
files = [f for f in files if re.search(r"/opensearch-([0-9.]*)\.yml$", f)]
19+
files = [f for f in files if re.search(r"[\\/]opensearch-([0-9.]*)\.yml$", f)]
2020
super().__init__(InputManifest, files)

src/manifests/manifests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __append__(self, files):
2929

3030
@property
3131
def manifests_path(self):
32-
return os.path.realpath(os.path.join(os.path.dirname(__file__), "../../manifests"))
32+
return os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "manifests"))
3333

3434
@property
3535
def versions(self):

0 commit comments

Comments
 (0)