Skip to content

Commit

Permalink
Fix a bug with providers
Browse files Browse the repository at this point in the history
  • Loading branch information
t-persson committed Jul 26, 2024
1 parent 62e1581 commit 9bb3005
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/environment_provider/environment_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,13 @@ def _run(self) -> dict:

def _configure_provider(self, provider_db: ETCDPath, provider_spec: dict, name: str):
"""Configure a single provider for a testrun."""
self.logger.info("Saving provider with name %r in %r", name, provider_db)
provider_model = ProviderSchema.model_validate(provider_spec)
if provider_model.spec.jsontas:
ruleset = json.dumps({name: provider_model.to_jsontas()})
else:
ruleset = json.dumps({name: provider_model.to_external()})
provider_db.join(name).write(ruleset)
provider_db.write(ruleset)

def _configure_iut(self, provider_spec: dict):
"""Configure iut provider for a testrun."""
Expand All @@ -639,6 +640,7 @@ def _configure_dataset(self, datasets: list[dict]):

def configure_environment_provider(self, suite_id: str):
"""Configure the environment provider if run as a part of the ETOS kubernetes controller."""
self.logger.info("Running in an ETOS cluster - Configuring testrun")
provider_client = Provider(self.kubernetes)
testrun_client = TestRun(self.kubernetes)
testrun = TestRunSchema.model_validate(testrun_client.get(f"testrun-{suite_id}").to_dict()) # type: ignore
Expand Down
4 changes: 0 additions & 4 deletions src/environment_provider/lib/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
from .database import ETCDPath


# TODO: Providers are not registered automatically when running ETOS cluster controller


class ProviderRegistry:
"""Environment provider registry."""

Expand Down Expand Up @@ -102,7 +99,6 @@ def get_log_area_provider(self) -> Optional[dict]:
return json.loads(provider, object_pairs_hook=OrderedDict)
return None

# def get_iut_provider_by_id(self, provider_id: str) -> Optional[dict]:
def get_iut_provider(self) -> Optional[dict]:
"""Get IUT provider for testrun from the ETOS Database.
Expand Down

0 comments on commit 9bb3005

Please sign in to comment.