Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for TES v1.1.0 #31

Merged
merged 9 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions compliance_suite/constants/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
This module contains the constant values used across the project. It is divided into suitable categories.
"""

from compliance_suite.models.v1_0_specs import (
TesCancelTaskResponse,
TesCreateTaskResponse,
TesListTasksResponse,
TesListTasksResponseMinimal,
TesServiceInfo,
TesTask,
TesTaskMinimal,
)

# Utility Constants

LOGGING_LEVEL = {
Expand All @@ -22,18 +12,19 @@
}

# API Constants
# 1. Basic & Full views have same required fields. Hence, validating Basic views against Full view Model.

ENDPOINT_TO_MODEL = {
'service_info': TesServiceInfo,
'list_tasks_MINIMAL': TesListTasksResponseMinimal,
'list_tasks_BASIC': TesListTasksResponse,
'list_tasks_FULL': TesListTasksResponse,
'get_task_MINIMAL': TesTaskMinimal,
'get_task_BASIC': TesTask,
'get_task_FULL': TesTask,
'create_task': TesCreateTaskResponse,
'create_task_request_body': TesTask,
'cancel_task': TesCancelTaskResponse
'service_info': 'TesServiceInfo',
'list_tasks_MINIMAL': 'TesListTasksResponseMinimal',
'list_tasks_BASIC': 'TesListTasksResponse',
'list_tasks_FULL': 'TesListTasksResponse',
'get_task_MINIMAL': 'TesTaskMinimal',
'get_task_BASIC': 'TesTask',
'get_task_FULL': 'TesTask',
'create_task': 'TesCreateTaskResponse',
'create_task_request_body': 'TesTask',
'cancel_task': 'TesCancelTaskResponse'
}

REQUEST_HEADERS = {
Expand Down
20 changes: 19 additions & 1 deletion compliance_suite/job_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,24 @@ def tag_matcher(
return True
return False

def version_matcher(
self,
versions: List[str]
) -> bool:
""" Matches the user provided spec version with the YAML test versions.
Skips the test if versions are not matched.

Args:
versions: The versions defined for a YAML test

Returns:
True, if the versions match. Otherwise, false.
"""

if self.version in versions:
return True
return False
uniqueg marked this conversation as resolved.
Show resolved Hide resolved

def generate_report(self) -> Any:
"""Generates the report via ga4gh-testbed-lib and returns it

Expand Down Expand Up @@ -170,7 +188,7 @@ def run_jobs(self) -> None:
if self.report.platform_name == "":
self.report.set_platform_details(self.server)

if self.tag_matcher(yaml_data["tags"]):
if self.version_matcher(yaml_data["versions"]) and self.tag_matcher(yaml_data["tags"]):
test_runner = TestRunner(yaml_data["service"], self.server, self.version)
job_count: int = 0
for job in yaml_data["jobs"]:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Module compliance_suite.models.v1_0_specs.py
"""Module compliance_suite.models.v1_0_0_specs.py

Pydantic generated models for TES API Specs v1.0
Pydantic generated models for TES API Specs v1.0.0
"""

from __future__ import annotations
Expand Down Expand Up @@ -429,6 +429,7 @@ class TesListTasksResponse(BaseModel):
)


# Extra models manually added for Minimal View
class TesTaskMinimal(BaseModel):
id: str = Field(
...,
Expand Down
Loading