Skip to content

Commit

Permalink
Added unit tests for TemporaryDirectory, ScriptFinder and GitReposito…
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock authored Aug 25, 2021
1 parent c467df5 commit 7d3ce9c
Show file tree
Hide file tree
Showing 69 changed files with 567 additions and 112 deletions.
16 changes: 15 additions & 1 deletion DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [Run Tests](#run-tests)
- [Run bundle-workflow](#run-bundle-workflow)
- [Code Linting](#code-linting)
- [Pre-Commit Cheatsheet](#pre-commit-cheatsheet)

## Developer Guide

Expand Down Expand Up @@ -107,4 +108,17 @@ All done! ✨ 🍰 ✨
23 files left unchanged.
```

If your code isn't properly formatted, don't worry, [a CI workflow](./github/workflows/test-bundle-workflow.yml) will make sure to remind you.
If your code isn't properly formatted, don't worry, [a CI workflow](./github/workflows/test-bundle-workflow.yml) will make sure to remind you.

### Pre-Commit Cheatsheet

Run from `bundle-workflow` before making pull requests.

```
cd bundle-workflow
pipenv run isort .
pipenv run black .
pipenv run flake8
pipenv run pytest
```
5 changes: 4 additions & 1 deletion bundle-workflow/assemble.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -e

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -e

Expand Down
55 changes: 0 additions & 55 deletions bundle-workflow/python/build_workflow/build_args.py

This file was deleted.

5 changes: 4 additions & 1 deletion bundle-workflow/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -e

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/OpenSearch/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
1 change: 1 addition & 0 deletions bundle-workflow/scripts/components/OpenSearch/integtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: This is used by script_finder tests, needs a working integtest.sh for OpenSearch.
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/alerting/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/common-utils/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/job-scheduler/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/k-NN/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/k-NN/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/notifications/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/components/security/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/default/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/scripts/default/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/src/assemble.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env python

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import argparse
import os
Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/src/assemble_workflow/bundle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import os
import shutil
Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/src/assemble_workflow/bundle_recorder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import os
from urllib.parse import urljoin
Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/src/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env python

# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import os
import uuid
Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/src/build_workflow/build_args.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import argparse
import sys
Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/src/build_workflow/build_recorder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import os
import shutil
Expand Down
5 changes: 4 additions & 1 deletion bundle-workflow/src/build_workflow/builder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import os

Expand Down
6 changes: 5 additions & 1 deletion bundle-workflow/src/git/git_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright OpenSearch Contributors.
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

import os
import subprocess
Expand All @@ -20,6 +23,7 @@ def __init__(self, url, ref, directory=None):
self.temp_dir = tempfile.TemporaryDirectory()
self.dir = self.temp_dir.name
else:
self.temp_dir = None
self.dir = directory
os.makedirs(self.dir, exist_ok=False)

Expand Down
Loading

0 comments on commit 7d3ce9c

Please sign in to comment.