Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKallekleiv committed Sep 2, 2024
1 parent 5e3d2c6 commit 4f90fb1
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 25 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/backend_sumo_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ jobs:
WEBVIZ_VDS_HOST_ADDRESS: 0
WEBVIZ_ENTERPRISE_SUBSCRIPTION_KEY: 0
WEBVIZ_SSDL_RESOURCE_SCOPE: 0
sharedkey_sumo_prod: ${{ secrets.SHARED_KEY_DROGON_READ_PROD }}
WEBVIZ_SUMU_ENV: prod
SHARED_KEY_SUMO_PROD: ${{ secrets.SHARED_KEY_DROGON_READ_PROD }}
run: |
echo "Length of sharedkey_sumo_prod variable read from Github Secrets:" ${#sharedkey_sumo_prod}
echo "Length of SHARED_KEY_SUMO_PROD variable read from Github Secrets:" ${#SHARED_KEY_SUMO_PROD}
mkdir ~/.sumo
echo $sharedkey_sumo_prod > ~/.sumo/9e5443dd-3431-4690-9617-31eed61cb55a.sharedkey
echo $SHARED_KEY_SUMO_PROD > ~/.sumo/9e5443dd-3431-4690-9617-31eed61cb55a.sharedkey
ls -l ~/.sumo/9e5443dd-3431-4690-9617-31eed61cb55a.sharedkey
pytest -s --timeout=300 ./tests/integration
Expand Down
3 changes: 1 addition & 2 deletions backend_py/primary/primary/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
SMDA_RESOURCE_SCOPE = os.environ["WEBVIZ_SMDA_RESOURCE_SCOPE"]
ENTERPRISE_SUBSCRIPTION_KEY = os.environ["WEBVIZ_ENTERPRISE_SUBSCRIPTION_KEY"]
SSDL_RESOURCE_SCOPE = os.environ["WEBVIZ_SSDL_RESOURCE_SCOPE"]
# SUMO_ENV = os.getenv("WEBVIZ_SUMO_ENV", "prod")
SUMO_ENV ="prod"
SUMO_ENV = os.getenv("WEBVIZ_SUMO_ENV", "prod")
GRAPH_SCOPES = ["User.Read", "User.ReadBasic.All"]
VDS_HOST_ADDRESS = os.environ["WEBVIZ_VDS_HOST_ADDRESS"]

Expand Down
1 change: 1 addition & 0 deletions backend_py/primary/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ disallow_untyped_defs = true
pythonpath = ["."]
filterwarnings = "ignore::DeprecationWarning:pkg_resources"
asyncio_mode="auto"
asyncio_default_fixture_loop_scope="session"


7 changes: 3 additions & 4 deletions backend_py/primary/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from dataclasses import dataclass

import pytest
from sumo.wrapper import SumoClient

from primary.services.utils.authenticated_user import AuthenticatedUser, AccessTokens

Expand All @@ -20,12 +19,12 @@ class SumoTestEnsemble:
ensemble_name: str


@pytest.fixture(name="sumo_test_ensemble_ahm")
def fixture_sumo_test_ensemble_ahm() -> SumoTestEnsemble:
@pytest.fixture(name="sumo_test_ensemble_prod", scope="session")
def fixture_sumo_test_ensemble_prod() -> SumoTestEnsemble:
return SumoTestEnsemble(case_uuid="485041ce-ad72-48a3-ac8c-484c0ed95cf8", ensemble_name="iter-0")


@pytest.fixture(name="test_user")
@pytest.fixture(name="test_user", scope="session")
def fixture_test_user():
token = "DUMMY_TOKEN_FOR_TESTING"
tokens = AccessTokens(sumo_access_token=token)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from primary.routers.explore import router, FieldInfo, CaseInfo,EnsembleInfo, EnsembleDetails




async def test_get_fields(test_user) -> None:
print(dir(router))
field_list = await router.get_fields(test_user)
assert isinstance(field_list, list[FieldInfo])
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
import numpy as np

from primary.routers.timeseries import router
from primary.routers.timeseries import schemas
import pytest


@pytest.mark.parametrize(
Expand All @@ -15,14 +15,14 @@
],
)
async def test_get_realizations_vector_data_dates(
test_user, sumo_test_ensemble_ahm, frequency, date_count, expected_mean
):
test_user, sumo_test_ensemble_prod, frequency, date_count, expected_mean
) -> None:

realization_data = await router.get_realizations_vector_data(
None,
test_user,
sumo_test_ensemble_ahm.case_uuid,
sumo_test_ensemble_ahm.ensemble_name,
sumo_test_ensemble_prod.case_uuid,
sumo_test_ensemble_prod.ensemble_name,
"FOPT",
frequency,
)
Expand All @@ -43,14 +43,14 @@ async def test_get_realizations_vector_data_dates(
],
)
async def test_get_realizations_vector_data_realizations(
test_user, sumo_test_ensemble_ahm, realizations, real_count, expected_mean
):
test_user, sumo_test_ensemble_prod, realizations, real_count, expected_mean
) -> None:

realization_data = await router.get_realizations_vector_data(
None,
test_user,
sumo_test_ensemble_ahm.case_uuid,
sumo_test_ensemble_ahm.ensemble_name,
sumo_test_ensemble_prod.case_uuid,
sumo_test_ensemble_prod.ensemble_name,
"FOPT",
schemas.Frequency.YEARLY,
realizations,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
from primary.routers.timeseries import router
from primary.routers.timeseries import schemas
from sumo.wrapper import SumoClient

from primary.services.utils.authenticated_user import AuthenticatedUser, AccessTokens
from primary.services.sumo_access.summary_access import SummaryAccess
from fmu.sumo.explorer import Explorer

async def test_get_vector_list(test_user, sumo_test_ensemble_ahm):
async def test_get_vector_list(test_user, sumo_test_ensemble_prod) -> None:

vector_list = await router.get_vector_list(
None, test_user, sumo_test_ensemble_ahm.case_uuid, sumo_test_ensemble_ahm.ensemble_name
None, test_user, sumo_test_ensemble_prod.case_uuid, sumo_test_ensemble_prod.ensemble_name
)

assert len(vector_list) == 786
assert isinstance(vector_list[0], schemas.VectorDescription)

0 comments on commit 4f90fb1

Please sign in to comment.