Skip to content

Add JSON schemas for the system tests YAML files - #948

Open
NopeCharon wants to merge 2 commits into
precice:developfrom
NopeCharon:yaml-schemas
Open

NopeCharon wants to merge 2 commits into
precice:developfrom
NopeCharon:yaml-schemas

Conversation

@NopeCharon

Copy link
Copy Markdown

Adds JSON schemas for tests/tests.yaml, tests/components.yaml, and the metadata.yaml files of the tutorials (in tests/schemas/), following up on #403 and the discussion in the earlier attempt #722.

  • The schemas follow what the parsers in tests/metadata_parser/ and tests/systemtests/TestSuite.py accept, including optional fields (max_time, max_time_windows, timeout, tolerance, skip_compare, run-before, run-after, external sources, build_timeout, value_options). The placeholder none cases with an empty run: are allowed.
  • All covered files now start with a # yaml-language-server: $schema=... comment, so editors using the YAML language server (e.g., VS Code) get autocompletion, hover documentation, and inline warnings.
  • The schemas are validated against all respective files via check-jsonschema in the pre-commit hooks (and thereby the "Check style" workflow). The schemas themselves are checked against the JSON Schema metaschema.
  • Documented in tests/README.md, including a note to extend the schema when adding options.

The component templates (tests/component-templates/) are Jinja templates and are not covered.

Closes #403

Checklist

  • I added a summary of any user-facing changes (compared to the last release) in the changelog-entries/<PRnumber>.md.

Add JSON schemas for tests.yaml, components.yaml, and the metadata.yaml
files of the tutorials, in tests/schemas/. They describe the structure
that the Python parsers in tests/metadata_parser and tests/systemtests
expect, including the optional fields (max_time, max_time_windows,
timeout, tolerance, skip_compare, run-before, run-after, external
sources, build_timeout, value_options).

Every schema-covered file now starts with a
"# yaml-language-server: $schema=..." comment, so that editors using the
YAML language server (e.g., VS Code) offer autocompletion and
documentation, and report mistakes while editing.

The schemas are also validated against all respective files via
check-jsonschema in the pre-commit hooks, and thus in the "Check style"
workflow, so that malformed test definitions are caught before the
system tests run. The schemas themselves are checked against the JSON
Schema metaschema.

Document the schemas in tests/README.md.

Closes precice#403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YAML schema for system test cases

1 participant