blob: 55b5b4eb45a3c8fdb6bb3e265bd61281157daa0a [file]
############################################################################
# Copyright (C) SchedMD LLC.
############################################################################
# import re
import json
import pytest
import atf
# Setup
@pytest.fixture(scope="module", autouse=True)
def setup():
atf.require_accounting()
atf.require_slurm_running()
@pytest.mark.parametrize(
"entry", ["accounts", "associations", "clusters", "qos", "wckeys", "users", "tres"]
)
def test_json(entry):
"""Verify sacctmgr --json has the correct format and meta data command"""
expected_command = ["sacctmgr", "--json", "show", entry]
output = atf.run_command_output(f"sacctmgr --json show {entry}", fatal=True)
json_data = json.loads(output)
assert json_data is not None
if atf.get_version("bin/sacctmgr") >= (26, 5):
assert json_data["meta"]["command"] == expected_command