Skip to content

Commit

Permalink
workflow updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelbaker-cisa committed Jul 26, 2024
1 parent ab06197 commit 97b756d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/run_smoke_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ jobs:
python -m venv .venv
.venv\Scripts\activate
- name: Install project dependencies and OPA
- name: Install dependencies
run: |
python -m pip install .
pip install -r requirements.txt
pip install pytest
pip uninstall numpy
pip install numpy==1.26.4
python download_opa.py -v 0.60.0 -os windows
- name: Download OPA executable
run: python download_opa.py -v 0.60.0 -os windows

- name: Execute ScubaGoggles and check for correct output
run: |
Expand Down
16 changes: 3 additions & 13 deletions Testing/Functional/SmokeTests/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@
class SmokeTest:
def test_venv_creation(self):
try:
result = subprocess.run(["ls", ".venv"], shell=True, capture_output=True, text=True)
result = subprocess.run(["ls", ".venv"], shell=True, capture_output=True, text=True, check=True)
if "Scripts" in result.stdout:
assert True
else:
assert False, f"Scripts was not found in the virtual environment"
except Exception as e:
except subprocess.CalledProcessError as e:
pytest.fail(f"An error occurred, {e}")


def test_scubagoggles(self, subjectemail):
try:
command = f"scubagoggles gws --subjectemail {subjectemail} --quiet"
Expand All @@ -33,17 +30,10 @@ def test_scubagoggles(self, subjectemail):
cwd = os.getcwd()
output_path = os.path.join(cwd, directories[0])
contents = verify_output_type(output_path, [])
print(contents)
verify_all_outputs_exist(contents)
except Exception as e:
except (OSError, ValueError, Exception) as e:
pytest.fail(f"An error occurred, {e}")







#def create_venv(env):
# result = subprocess.run(["python", "-m", "venv", env])
# if result.returncode == 0:
Expand Down
21 changes: 11 additions & 10 deletions Testing/Functional/SmokeTests/smoke_test_utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pytest
import os

required_contents = [
"BaselineReports.html",
"IndividualReports",
"ScubaResults.json",
"ProviderExport.json",
"TestResults.json",
"images",
"CalendarReport.html",
Expand All @@ -20,13 +21,6 @@
"triangle-exclamation-solid.svg"
]

def verify_all_outputs_exist(contents):
for required_content in required_contents:
if required_content in contents:
assert True
else:
assert False, f"{required_content} was not found in the generated report"

def verify_output_type(output_path, contents):
entries = os.listdir(output_path)

Expand All @@ -41,6 +35,13 @@ def verify_output_type(output_path, contents):
elif os.path.isfile(child_path):
assert True
else:
assert False, f"Entry is not a directory or file (symlink, etc.)"
raise OSError(f"Entry is not a directory or file (symlink, etc.)")

return contents
return contents

def verify_all_outputs_exist(contents):
for required_content in required_contents:
if required_content in contents:
assert True
else:
raise ValueError(f"{required_content} was not found in the generated report")

0 comments on commit 97b756d

Please sign in to comment.