Skip to content

Commit 753b97a

Browse files
author
Vasileios Karakasis
committed
Add unit test for CI generate
1 parent fcf0023 commit 753b97a

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
coverage==5.3
12
importlib_metadata==2.0.0
23
jsonschema==3.2.0
34
pytest==6.2.0
45
pytest-forked==1.3.0
56
pytest-parallel==0.1.0
6-
coverage==5.3
7+
requests==2.25.1
78
setuptools==50.3.0
89
wcwidth==0.2.5
910
PyYAML==5.3.1

unittests/test_ci.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
2+
# ReFrame Project Developers. See the top-level LICENSE file for details.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
6+
7+
import io
8+
import pytest
9+
import requests
10+
11+
import reframe.frontend.ci as ci
12+
import reframe.frontend.dependencies as dependencies
13+
import reframe.frontend.executors as executors
14+
from reframe.frontend.loader import RegressionCheckLoader
15+
16+
17+
def test_ci_gitlab_pipeline():
18+
loader = RegressionCheckLoader([
19+
'unittests/resources/checks_unlisted/deps_complex.py'
20+
])
21+
cases = dependencies.toposort(
22+
dependencies.build_deps(
23+
executors.generate_testcases(loader.load_all())
24+
)[0]
25+
)
26+
with io.StringIO() as fp:
27+
ci.emit_pipeline(fp, cases)
28+
yaml = fp.getvalue()
29+
30+
response = requests.post('https://gitlab.com/api/v4/ci/lint',
31+
data={'content': {yaml}})
32+
assert response.ok
33+
assert response.json()['status'] == 'valid'

0 commit comments

Comments
 (0)