Skip to content

[DPE-11496] (PART 9) CI/CD migration to single-kernel: jubilant migration, part 2 - #432

Draft
xavipg003 wants to merge 4 commits into
16/edgefrom
dpe-11496-9
Draft

xavipg003 wants to merge 4 commits into
16/edgefrom
dpe-11496-9

Conversation

@xavipg003

Copy link
Copy Markdown
Contributor

Description

This PR continues moving the PostgreSQL integration tests from the VM and K8s charm repos into the single kernel library. Builds on #431.

It migrates the HA tests that check continuous writes and scaling from pytest-operator to jubilant, and moves them to the jubilant HA folder.

What's included

  • Migrated to jubilant:
    • test_replication (VM and K8s).
    • test_scaling, test_scaling_three_units, test_scaling_three_units_async (VM only).
    • test_restart (K8s only).
  • New sync helpers in charm/helpers.py: faithful copies of the HA helpers from ha_tests/helpers.py and pytest_operator_helpers.py. They cover continuous writes (start_ha_continuous_writes, stop_continuous_writes, count_writes, are_writes_increasing, check_writes), the Patroni cluster (get_ha_cluster_roles, fetch_cluster_members, is_replica, is_secondary_up_to_date, is_cluster_updated, get_patroni_setting, change_ha_patroni_setting), unit selection and addresses (get_postgresql_app_name, get_primary_from_app, get_unit_ip, get_machine_from_unit, ...) and scaling (scale_ha_application).
  • wait_for_idle in helpers/juju.py: a jubilant version of libjuju's wait_for_idle, with the same per-unit idle period, status and error checks, exact unit count and timeouts.
  • Fixtures in high_availability/conftest.py: juju_continuous_writes and juju_primary_start_timeout, sync copies of the async continuous_writes and primary_start_timeout.
  • Move: the five tests move unchanged from ha_tests/ to high_availability/, in a separate commit. Their Spread tasks point to the new path.

How the migration was done

  • Change only what jubilant needs. Keep the original test names, marks (vm_only, k8s_only, abort_on_fail), parametrizations, retries, timeouts, waits and unit selection.
  • Use the juju fixture instead of ops_test. asyncio.gather calls become sequential calls, block_until becomes juju.wait, and run_action becomes juju.run.
  • The HA helpers whose behaviour differs from the existing helpers with the same name get their own name (get_ha_cluster_roles, change_ha_patroni_setting, start_ha_continuous_writes, scale_ha_application). The existing helpers and the tests that use them don't change.
  • The async helpers and fixtures in ha_tests/ stay, because the tests not migrated yet still use them.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant