Skip to content

Commit d1ed0a1

Browse files
authored
Merge pull request #558 from pretendWhale/v2.5.2
V2.5.2
2 parents 51745dd + 9a6e8c2 commit d1ed0a1

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# CHANGELOG
22
All notable changes to this project will be documented here.
33

4+
## [v2.5.2]
5+
- Haskell Tests - allow displaying of compilation errors (#554)
6+
- Add status api for monitoring if Gunicorn is down (#555)
7+
48
## [v2.5.1]
59
- Ensure all Haskell test cases still run within same file when there are failed test cases (#543)
610

client/autotest_client/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,8 @@ def cancel_tests(settings_id, **_kw):
319319
for id_, job in zip(test_ids, _get_jobs(test_ids, settings_id)):
320320
result[id_] = job if job is None else job.cancel()
321321
return jsonify(success=True)
322+
323+
324+
@app.route("/status", methods=["GET"])
325+
def status():
326+
return jsonify(success=True)

client/autotest_client/tests/test_flask_app.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,16 @@ def test_api_key_set(self, response):
3838

3939
def test_credentials_set(self, response, fake_redis_conn, credentials):
4040
assert json.loads(fake_redis_conn.hget("autotest:user_credentials", response.json["api_key"])) == credentials
41+
42+
43+
class TestStatus:
44+
45+
@pytest.fixture
46+
def response(self, client):
47+
return client.get("/status")
48+
49+
def test_status_code(self, response):
50+
assert response.status_code == 200
51+
52+
def test_success(self, response):
53+
assert response.json["success"] is True

server/autotest_server/testers/haskell/haskell_tester.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,14 @@ def run_haskell_tests(self) -> Dict[str, List[Dict[str, Union[int, str]]]]:
120120
subprocess.run(cmd, stdout=subprocess.DEVNULL, universal_newlines=True, check=True)
121121
with tempfile.NamedTemporaryFile(mode="w+", dir=this_dir) as sf:
122122
cmd = ["stack", "runghc", *STACK_OPTIONS, "--", f"-i={haskell_lib}", f.name, f"--stats={sf.name}"]
123-
try:
124-
subprocess.run(
125-
cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, check=True
126-
)
127-
except subprocess.CalledProcessError as e:
128-
if e.returncode == 1:
129-
pass
130-
else:
131-
raise Exception(e)
132-
results[test_file] = self._parse_test_results(csv.reader(sf))
123+
out = subprocess.run(
124+
cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, universal_newlines=True, check=False
125+
)
126+
r = self._parse_test_results(csv.reader(sf))
127+
if r:
128+
results[test_file] = r
129+
else:
130+
raise Exception(out.stderr)
133131
return results
134132

135133
@Tester.run_decorator

0 commit comments

Comments
 (0)