Skip to content
Snippets Groups Projects
Commit d2b4d9ff authored by Karim Ahmed's avatar Karim Ahmed
Browse files

Move tests to individual directory and test manual trigger for the test pipeline

parent d887f3f7
No related branches found
No related tags found
1 merge request!610Add a pytest to run a dict of CALLAB test runs before releases
...@@ -50,41 +50,6 @@ def pytest_addoption(parser): ...@@ -50,41 +50,6 @@ def pytest_addoption(parser):
help="Skips tests marked as requiring myMDC access", help="Skips tests marked as requiring myMDC access",
) )
parser.addoption(
"--release-test",
action="store_true",
default=False,
help="Start release test for all supported calibration notebooks",
)
detectors_choices = []
for k in ['agipd', 'jungfrau', 'pnccd', 'epix100', 'all']:
detectors_choices += [k, k.upper()]
parser.addoption(
"--detectors",
action='append',
choices=detectors_choices,
)
parser.addoption(
"--calibration",
type=str,
choices=['correct', 'dark', 'all'],
default='all',
)
parser.addoption(
"--no-numerical-validation",
action="store_true",
default=False,
help="Skips tests for numerical validation for produced h5files.",
)
parser.addoption(
"--picked-test",
type=str,
default=None,
)
def pytest_configure(config): def pytest_configure(config):
config.addinivalue_line( config.addinivalue_line(
...@@ -102,26 +67,6 @@ def pytest_configure(config): ...@@ -102,26 +67,6 @@ def pytest_configure(config):
"requires_mdc(): marks skips for tests that require calDB access", "requires_mdc(): marks skips for tests that require calDB access",
) )
config.addinivalue_line(
"markers",
"manual_run(): marks skips for tests that required to be run manually",
)
config.addinivalue_line(
"markers",
"manual_run(): marks skips for tests that required to be run manually",
)
@pytest.fixture
def release_test_config(request):
detectors = request.config.getoption("--detectors")
calibration = request.config.getoption("--calibration")
skip_numerical_validation = request.config.getoption(
"--no-numerical-validation")
picked_test = request.config.getoption("--picked-test")
return detectors, calibration, picked_test, skip_numerical_validation
@lru_cache() @lru_cache()
def server_reachable(server: str = "max-exfl-cal002"): def server_reachable(server: str = "max-exfl-cal002"):
...@@ -148,9 +93,3 @@ def pytest_runtest_setup(item): ...@@ -148,9 +93,3 @@ def pytest_runtest_setup(item):
item.config.getoption("--no-mdc") item.config.getoption("--no-mdc")
): ):
pytest.skip("myMDC not available") pytest.skip("myMDC not available")
if (
list(item.iter_markers(name="manual_run")) and
not item.config.getoption("--release-test")
):
pytest.skip("Test initialized manually")
automated_test_config = {
"SPB_DET_AGIPD1M-1-CORRECT-FIXED":
{
"det_type": "AGIPD",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
"run": "95",
"karabo-id-control": "SPB_IRU_AGIPD1M1",
"karabo-id": "SPB_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}"
},
"SPB_DET_AGIPD1M-1-DARK-FIXED":
{
"det_type": "AGIPD",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
"run-high": "91",
"run-med": "92",
"run-low": "93",
"karabo-id-control": "SPB_IRU_AGIPD1M1",
"karabo-id": "SPB_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"SPB_DET_AGIPD1M-1-CORRECT-ADAPTIVE":{
"det_type": "AGIPD",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
"run": "262",
"karabo-id-control": "SPB_IRU_AGIPD1M1",
"karabo-id": "SPB_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"SPB_DET_AGIPD1M-1-DARK-ADAPTIVE":
{
"det_type": "AGIPD",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SPB/202131/p900215/raw",
"run-high": "216",
"run-med": "217",
"run-low": "218",
"karabo-id-control": "SPB_IRU_AGIPD1M1",
"karabo-id": "SPB_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"MID_DET_AGIPD1M-1-CORRECT-ADAPTIVE":
{
"det_type": "AGIPD",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
"run": "21",
"karabo-id-control": "MID_EXP_AGIPD1M1",
"karabo-id": "MID_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"MID_DET_AGIPD1M-1-DARK-ADAPTIVE":
{
"det_type": "AGIPD",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
"run-high": "4",
"run-med": "5",
"run-low": "6",
"karabo-id-control": "MID_EXP_AGIPD1M1",
"karabo-id": "MID_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"HED_DET_AGIPD500K2G-CORRECT-ADAPTIVE":
{
"det_type": "AGIPD",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/HED/202131/p900228/raw",
"run": "29",
"karabo-id-control": "HED_EXP_AGIPD500K2G",
"karabo-id": "HED_DET_AGIPD500K2G",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"HED_DET_AGIPD500K2G-DARK-ADAPTIVE":{
"det_type": "AGIPD",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/HED/202131/p900228/raw",
"run-high": "25",
"run-med": "26",
"run-low": "27",
"karabo-id-control": "HED_EXP_AGIPD500K2G",
"karabo-id": "HED_DET_AGIPD500K2G",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"MID_DET_AGIPD1M-1-CORRECT-SELECT_CELLS_CM":
{
"det_type": "AGIPD",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
"run": "21",
"max-pulses": [0, 160, 2],
"common-mode": True,
"karabo-id-control": "MID_EXP_AGIPD1M1",
"karabo-id": "MID_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"MID_DET_AGIPD1M-1-CORRECT-SELECT_CELLS_NOCM":
{
"det_type": "AGIPD",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/MID/202121/p002929/raw",
"run": "21",
"max-pulses": [0, 160, 2],
"no-common-mode": True,
"karabo-id-control": "MID_EXP_AGIPD1M1",
"karabo-id": "MID_DET_AGIPD1M-1",
"slurm-mem": "750",
"ctrl-source-template": "{}/MDL/FPGA_COMP",
},
"reference-folder": "{}/{}/{}",
},
"FXE_XAD_JF500K-DARK-SINGLE":
{
"det_type": "JUNGFRAU",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
"run-high": "47",
"run-med": "48",
"run-low": "49",
"karabo-id-control": "",
"karabo-id": "FXE_XAD_JF500K",
"karabo-da": "JNGFR03",
},
"reference-folder": "{}/{}/{}",
},
"FXE_XAD_JF500K-CORRECT-SINGLE":
{
"det_type": "JUNGFRAU",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
"run": "52",
"karabo-id-control": "",
"karabo-id": "FXE_XAD_JF500K",
"karabo-da": "JNGFR03",
},
"reference-folder": "{}/{}/{}",
},
"FXE_XAD_JF1M-DARK-BURST":
{
"det_type": "JUNGFRAU",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/FXE/202131/p900226/raw/",
"run-high": "108",
"run-med": "109",
"run-low": "110",
"karabo-id-control": "",
"karabo-id": "FXE_XAD_JF1M",
"karabo-da": ["JNGFR01", "JNGFR02"],
},
"reference-folder": "{}/{}/{}",
},
"FXE_XAD_JF1M-CORRECT-BURST":
{
"det_type": "JUNGFRAU",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/FXE/202131/p900226/raw",
"run": "106",
"karabo-id-control": "",
"karabo-id": "FXE_XAD_JF1M",
"karabo-da": ["JNGFR01", "JNGFR02"],
},
"reference-folder": "{}/{}/{}",
},
"FXE_XAD_JF1M-DARK-SINGLE":
{
"det_type": "JUNGFRAU",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
"run-high": "47",
"run-med": "48",
"run-low": "49",
"karabo-id-control": "",
"karabo-id": "FXE_XAD_JF1M",
"karabo-da": ["JNGFR01", "JNGFR02"],
},
"reference-folder": "{}/{}/{}",
},
"FXE_XAD_JF1M-CORRECT-SINGLE":
{
"det_type": "JUNGFRAU",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/FXE/202101/p002478/raw/",
"run": "52",
"karabo-id-control": "",
"karabo-id": "FXE_XAD_JF1M",
"karabo-da": ["JNGFR01", "JNGFR02"],
},
"reference-folder": "{}/{}/{}",
},
"SPB_IRDA_JF4M-CORRECT-SINGLE":
{
"det_type": "JUNGFRAU",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SPB/202130/p900204/raw",
"run": "91",
"karabo-id-control": "",
"karabo-id": "SPB_IRDA_JF4M",
"karabo-da": [
"JNGFR01", "JNGFR02", "JNGFR03", "JNGFR04",
"JNGFR05", "JNGFR06", "JNGFR07", "JNGFR08"
],
},
"reference-folder": "{}/{}/{}",
},
"SPB_IRDA_JF4M-DARK-ADAPTIVE":
{
"det_type": "JUNGFRAU",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SPB/202130/p900204/raw",
"run-high": "88",
"run-med": "89",
"run-low": "90",
"karabo-id-control": "",
"karabo-id": "SPB_IRDA_JF4M",
"karabo-da": [
"JNGFR01", "JNGFR02", "JNGFR03", "JNGFR04",
"JNGFR05", "JNGFR06", "JNGFR07", "JNGFR08"
],
},
"reference-folder": "{}/{}/{}",
},
"HED_IA1_JF500K1-CORRECT-ADAPTIVE":
{
"det_type": "JUNGFRAU",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
"run": "230",
"karabo-id": "HED_IA1_JF500K1",
"karabo-da": "JNGFR01",
},
"reference-folder": "{}/{}/{}",
},
"HED_IA1_JF500K1-DARK-ADAPTIVE":
{
"det_type": "JUNGFRAU",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
"run-high": "219",
"run-med": "220",
"run-low": "221",
"karabo-id": "HED_IA1_JF500K1",
"karabo-da": "JNGFR01",
},
"reference-folder": "{}/{}/{}",
},
"HED_IA1_EPX100-1-CORRECT":
{
"det_type": "EPIX100",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
"run": "230",
"karabo-id": "HED_IA1_EPX100-1",
"karabo-da": "EPIX01",
},
"reference-folder": "{}/{}/{}",
},
"HED_IA1_EPX100-1-DARK":
{
"det_type": "EPIX100",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/HED/202102/p002656/raw",
"run": "219",
"karabo-id": "HED_IA1_EPX100-1",
"karabo-da": "EPIX01",
},
"reference-folder": "{}/{}/{}",
},
"SQS_NQS_PNCCD1MP-CORRECT":
{
"det_type": "PNCCD",
"cal_type": "CORRECT",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SQS/202031/p900166/raw",
"run": "347",
"karabo-id": "SQS_NQS_PNCCD1MP",
"karabo-da": "PNCCD01",
},
"reference-folder": "{}/{}/{}"
},
"SQS_NQS_PNCCD1MP-DARK":
{
"det_type": "PNCCD",
"cal_type": "DARK",
"config":
{
"out-folder": "{}/{}/{}",
"in-folder": "/gpfs/exfel/exp/SQS/202031/p900166/raw",
"run": "345",
"karabo-id": "SQS_NQS_PNCCD1MP",
"karabo-da": "PNCCD01",
},
"reference-folder": "{}/{}/{}",
},
}
\ No newline at end of file
import pytest
def pytest_addoption(parser):
parser.addoption(
"--release-test",
action="store_true",
default=False,
help="Start release test for all supported calibration notebooks",
)
detectors_choices = []
for k in ['agipd', 'jungfrau', 'pnccd', 'epix100', 'all']:
detectors_choices += [k, k.upper()]
parser.addoption(
"--detectors",
action='append',
choices=detectors_choices,
default=['all'],
)
parser.addoption(
"--calibration",
type=str,
choices=['correct', 'dark', 'all'],
default='all',
)
parser.addoption(
"--no-numerical-validation",
action="store_true",
default=False,
help="Skips tests for numerical validation for produced h5files.",
)
parser.addoption(
"--picked-test",
type=str,
default=None,
)
parser.addoption(
"--out-folder",
type=str,
)
parser.addoption(
"--reference-folder",
type=str,
)
@pytest.fixture
def release_test_config(request):
detectors = request.config.getoption("--detectors")
calibration = request.config.getoption("--calibration")
skip_numerical_validation = request.config.getoption(
"--no-numerical-validation")
picked_test = request.config.getoption("--picked-test")
return detectors, calibration, picked_test, skip_numerical_validation
def pytest_configure(config):
config.addinivalue_line(
"markers",
"manual_run(): marks skips for tests that required to be run manually",
)
def pytest_runtest_setup(item):
if (
list(item.iter_markers(name="manual_run")) and
not item.config.getoption("--release-test")
):
pytest.skip("Test initialized manually")
\ No newline at end of file
...@@ -17,11 +17,7 @@ import yaml ...@@ -17,11 +17,7 @@ import yaml
import xfel_calibrate.calibrate as calibrate import xfel_calibrate.calibrate as calibrate
from cal_tools import h5_copy_except from cal_tools import h5_copy_except
REFERENCE_FOLDER = "/gpfs/exfel/data/scratch/ahmedk/test/release_test_3.5.0b3/" from .callab_tests import automated_test_config
OUT_FOLDER = "/gpfs/exfel/data/scratch/ahmedk/test/3.5.1test1/"
with open("./tests/callab_tests.yaml", "r") as f:
callab_test_dict = yaml.load(f)
def file_md5( def file_md5(
...@@ -151,8 +147,8 @@ def parse_config( ...@@ -151,8 +147,8 @@ def parse_config(
@pytest.mark.manual_run @pytest.mark.manual_run
@pytest.mark.parametrize( @pytest.mark.parametrize(
"test_key, val_dict", "test_key, val_dict",
list(callab_test_dict.items()), list(automated_test_config.items()),
ids=list(callab_test_dict.keys()), ids=list(automated_test_config.keys()),
) )
def test_xfel_calibrate( def test_xfel_calibrate(
test_key: str, val_dict: dict, test_key: str, val_dict: dict,
...@@ -168,8 +164,8 @@ def test_xfel_calibrate( ...@@ -168,8 +164,8 @@ def test_xfel_calibrate(
""" """
( (
detectors, calibration, detectors, calibration, picked_test,
picked_test, skip_numerical_validation skip_numerical_validation, reference_dir_base, out_dir_base,
) = release_test_config ) = release_test_config
cal_type = val_dict["cal_type"] cal_type = val_dict["cal_type"]
...@@ -196,11 +192,11 @@ def test_xfel_calibrate( ...@@ -196,11 +192,11 @@ def test_xfel_calibrate(
cal_conf["report-to"] = report_name cal_conf["report-to"] = report_name
out_folder = pathlib.Path(cal_conf["out-folder"].format( out_folder = pathlib.Path(cal_conf["out-folder"].format(
OUT_FOLDER, cal_conf["karabo-id"], test_key)) out_dir_base, cal_conf["karabo-id"], test_key))
cmd = parse_config(cmd, cal_conf, out_folder) cmd = parse_config(cmd, cal_conf, out_folder)
reference_folder = pathlib.Path(val_dict["reference-folder"].format( reference_folder = pathlib.Path(val_dict["reference-folder"].format(
REFERENCE_FOLDER, cal_conf["karabo-id"], test_key)) reference_dir_base, cal_conf["karabo-id"], test_key))
cmd += ["--slurm-name", test_key] cmd += ["--slurm-name", test_key]
f = io.StringIO() f = io.StringIO()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment