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

Disable external HTTP request in wp theme list and wp plugin list command #193

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 9 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,15 @@ def _wp_addon_list(self, addon_type: str):
# FIXME: the feedwordpress plugin causes the `wp theme list` command to fail occasionally
# use retries as a temporary workaround for this issue
for wait in (1, 3, 5, 5, 5):
process = self._run_wp_cli(["wp", addon_type, "list", "--format=json"], timeout=600)
process = self._run_wp_cli(
[
"wp",
addon_type,
"list",
"--exec=define( 'WP_HTTP_BLOCK_EXTERNAL', TRUE );",
"--format=json",
],
)
if process.return_code == 0:
break
time.sleep(wait)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def prepare_mysql(ops_test: OpsTest, wordpress: WordpressApp, model: Model
"deploy", "mysql-k8s", "--channel=8.0/candidate", "--revision=75", "--trust"
)
await model.wait_for_idle(status="active", apps=["mysql-k8s"], timeout=30 * 60)
await model.add_relation(f"{wordpress.name}:database", "mysql-k8s:database")
await model.relate(f"{wordpress.name}:database", "mysql-k8s:database")
await model.wait_for_idle(
status="active", apps=["mysql-k8s", wordpress.name], timeout=40 * 60, idle_period=30
)
Expand All @@ -113,7 +113,7 @@ async def prepare_machine_mysql(
await machine_model.deploy("mysql", channel="8.0/edge", trust=True)
await machine_model.create_offer("mysql:database")
await machine_model.wait_for_idle(status="active", apps=["mysql"], timeout=30 * 60)
await model.add_relation(
await model.relate(
f"{wordpress.name}:database",
f"{machine_controller.controller_name}:admin/{machine_model.name}.mysql",
)
Expand Down Expand Up @@ -211,7 +211,7 @@ async def prepare_nginx_ingress(wordpress: WordpressApp, prepare_mysql):
await wordpress.model.wait_for_idle(
status="active", apps=["nginx-ingress-integrator"], timeout=30 * 60
)
await wordpress.model.add_relation(f"{wordpress.name}:nginx-route", "nginx-ingress-integrator")
await wordpress.model.relate(f"{wordpress.name}:nginx-route", "nginx-ingress-integrator")
await wordpress.model.wait_for_idle(status="active")


Expand All @@ -224,7 +224,7 @@ async def prepare_prometheus(wordpress: WordpressApp, prepare_mysql):
await wordpress.model.wait_for_idle(
status="active", apps=[prometheus.name], raise_on_error=False, timeout=30 * 60
)
await wordpress.model.add_relation(f"{wordpress.name}:metrics-endpoint", prometheus.name)
await wordpress.model.relate(f"{wordpress.name}:metrics-endpoint", prometheus.name)
await wordpress.model.wait_for_idle(
status="active",
apps=[prometheus.name, wordpress.name],
Expand All @@ -238,7 +238,7 @@ async def prepare_loki(wordpress: WordpressApp, prepare_mysql):
"""Deploy and relate loki-k8s charm for integration tests."""
loki = await wordpress.model.deploy("loki-k8s", channel="1.0/stable", trust=True)
await wordpress.model.wait_for_idle(apps=[loki.name], status="active", timeout=20 * 60)
await wordpress.model.add_relation(f"{wordpress.name}:logging", loki.name)
await wordpress.model.relate(f"{wordpress.name}:logging", loki.name)
await wordpress.model.wait_for_idle(
apps=[loki.name, wordpress.name], status="active", timeout=40 * 60
)
Loading