Skip to content

Commit

Permalink
Merge pull request #558 from pretendWhale/v2.5.2
Browse files Browse the repository at this point in the history
V2.5.2
  • Loading branch information
donny-wong authored Oct 2, 2024
2 parents 51745dd + 9a6e8c2 commit d1ed0a1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# CHANGELOG
All notable changes to this project will be documented here.

## [v2.5.2]
- Haskell Tests - allow displaying of compilation errors (#554)
- Add status api for monitoring if Gunicorn is down (#555)

## [v2.5.1]
- Ensure all Haskell test cases still run within same file when there are failed test cases (#543)

Expand Down
5 changes: 5 additions & 0 deletions client/autotest_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,8 @@ def cancel_tests(settings_id, **_kw):
for id_, job in zip(test_ids, _get_jobs(test_ids, settings_id)):
result[id_] = job if job is None else job.cancel()
return jsonify(success=True)


@app.route("/status", methods=["GET"])
def status():
return jsonify(success=True)
13 changes: 13 additions & 0 deletions client/autotest_client/tests/test_flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,16 @@ def test_api_key_set(self, response):

def test_credentials_set(self, response, fake_redis_conn, credentials):
assert json.loads(fake_redis_conn.hget("autotest:user_credentials", response.json["api_key"])) == credentials


class TestStatus:

@pytest.fixture
def response(self, client):
return client.get("/status")

def test_status_code(self, response):
assert response.status_code == 200

def test_success(self, response):
assert response.json["success"] is True
18 changes: 8 additions & 10 deletions server/autotest_server/testers/haskell/haskell_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,14 @@ def run_haskell_tests(self) -> Dict[str, List[Dict[str, Union[int, str]]]]:
subprocess.run(cmd, stdout=subprocess.DEVNULL, universal_newlines=True, check=True)
with tempfile.NamedTemporaryFile(mode="w+", dir=this_dir) as sf:
cmd = ["stack", "runghc", *STACK_OPTIONS, "--", f"-i={haskell_lib}", f.name, f"--stats={sf.name}"]
try:
subprocess.run(
cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, check=True
)
except subprocess.CalledProcessError as e:
if e.returncode == 1:
pass
else:
raise Exception(e)
results[test_file] = self._parse_test_results(csv.reader(sf))
out = subprocess.run(
cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, check=False
)
r = self._parse_test_results(csv.reader(sf))
if r:
results[test_file] = r
else:
raise Exception(out.stderr)
return results

@Tester.run_decorator
Expand Down

0 comments on commit d1ed0a1

Please sign in to comment.