Skip to content

Commit

Permalink
Switch to relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirp committed Nov 1, 2023
1 parent eaa88eb commit fc2caa5
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 27 deletions.
Empty file added tests/integration/__init__.py
Empty file.
Empty file.
4 changes: 2 additions & 2 deletions tests/integration/ha_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from tests.integration.ha_tests.helpers import (
from .helpers import (
APPLICATION_NAME,
ORIGINAL_RESTART_CONDITION,
RESTART_CONDITION,
Expand All @@ -18,7 +18,7 @@
get_postgresql_parameter,
update_restart_condition,
)
from tests.integration.helpers import run_command_on_unit
from ..helpers import run_command_on_unit


@pytest.fixture()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/ha_tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
wait_fixed,
)

from tests.integration.helpers import db_connect, get_unit_address, run_command_on_unit
from ..helpers import db_connect, get_unit_address, run_command_on_unit

APPLICATION_NAME = "postgresql-test-app"
METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ha_tests/test_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from tests.integration.ha_tests.helpers import (
from .helpers import (
APPLICATION_NAME,
app_name,
are_writes_increasing,
Expand All @@ -16,7 +16,7 @@
get_primary,
start_continuous_writes,
)
from tests.integration.helpers import CHARM_SERIES, db_connect, scale_application
from ..helpers import CHARM_SERIES, db_connect, scale_application


@pytest.mark.group(1)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ha_tests/test_restore_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import pytest
from pytest_operator.plugin import OpsTest

from tests.integration.ha_tests.helpers import (
from .helpers import (
add_unit_with_storage,
get_patroni_cluster,
reused_full_cluster_recovery_storage,
storage_id,
)
from tests.integration.helpers import (
from ..helpers import (
CHARM_SERIES,
db_connect,
get_password,
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/ha_tests/test_self_healing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from tests.integration.ha_tests.conftest import APPLICATION_NAME
from tests.integration.ha_tests.helpers import (
from .conftest import APPLICATION_NAME
from .helpers import (
METADATA,
ORIGINAL_RESTART_CONDITION,
add_unit_with_storage,
Expand Down Expand Up @@ -43,7 +43,7 @@
update_restart_condition,
wait_network_restore,
)
from tests.integration.helpers import (
from ..helpers import (
CHARM_SERIES,
db_connect,
get_machine_from_unit,
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/ha_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
import pytest
from pytest_operator.plugin import OpsTest

from tests.integration.ha_tests.helpers import (
from .helpers import (
APPLICATION_NAME,
are_writes_increasing,
check_writes,
start_continuous_writes,
)
from tests.integration.helpers import (
from ..helpers import (
DATABASE_APP_NAME,
count_switchovers,
get_leader_unit,
get_primary,
)
from tests.integration.new_relations.helpers import get_application_relation_data
from ..new_relations.helpers import get_application_relation_data

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ha_tests/test_upgrade_from_stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import pytest
from pytest_operator.plugin import OpsTest

from tests.integration.ha_tests.helpers import (
from .helpers import (
APPLICATION_NAME,
are_writes_increasing,
check_writes,
start_continuous_writes,
)
from tests.integration.helpers import (
from ..helpers import (
DATABASE_APP_NAME,
count_switchovers,
get_leader_unit,
Expand Down
1 change: 1 addition & 0 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
CHARM_SERIES = "jammy"
METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
DATABASE_APP_NAME = METADATA["name"]
STORAGE_PATH = METADATA["storage"]["pgdata"]["location"]


async def build_connection_string(
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions tests/integration/new_relations/test_new_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import yaml
from pytest_operator.plugin import OpsTest

from tests.integration.helpers import CHARM_SERIES, scale_application
from tests.integration.new_relations.helpers import (
from ..helpers import CHARM_SERIES, scale_application
from .helpers import (
build_connection_string,
check_relation_data_existence,
get_application_relation_data,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_attempt, wait_exponential

from tests.integration.helpers import (
from .helpers import (
CHARM_SERIES,
DATABASE_APP_NAME,
construct_endpoint,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_attempt, wait_exponential

from tests.helpers import STORAGE_PATH
from tests.integration.helpers import (
from .helpers import (
CHARM_SERIES,
DATABASE_APP_NAME,
STORAGE_PATH,
check_cluster_members,
convert_records_to_dict,
db_connect,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_delay, wait_fixed

from tests.integration.helpers import (
from .helpers import (
CHARM_SERIES,
DATABASE_APP_NAME,
build_connection_string,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_db_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from landscape_api.base import HTTPError, run_query
from pytest_operator.plugin import OpsTest

from tests.integration.helpers import (
from .helpers import (
CHARM_SERIES,
DATABASE_APP_NAME,
check_database_users_existence,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_password_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import pytest
from pytest_operator.plugin import OpsTest

from tests.helpers import METADATA
from tests.integration.helpers import (
from .helpers import (
CHARM_SERIES,
METADATA,
check_patroni,
get_password,
restart_patroni,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest as pytest
from pytest_operator.plugin import OpsTest

from tests.integration.helpers import (
from .helpers import (
CHARM_SERIES,
DATABASE_APP_NAME,
db_connect,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from pytest_operator.plugin import OpsTest
from tenacity import Retrying, stop_after_attempt, stop_after_delay, wait_exponential

from tests.helpers import METADATA
from tests.integration.helpers import (
from .helpers import (
CHARM_SERIES,
METADATA,
DATABASE_APP_NAME,
change_primary_start_timeout,
check_tls,
Expand Down

0 comments on commit fc2caa5

Please sign in to comment.