Skip to content

Commit

Permalink
Merge pull request #12 from canonical/fix-init-integration-tests
Browse files Browse the repository at this point in the history
Increased retry wait in integration tests
  • Loading branch information
Mehdi-Bendriss authored Oct 26, 2022
2 parents dcb5d11 + f2ea38f commit daa9dbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ jobs:
with:
provider: lxd
- name: Run integration tests
run: tox -e charm-integration
run: |
# set sysctl values in case the cloudinit-userdata not applied
sudo sysctl -w vm.max_map_count=262144
sudo sysctl -w vm.swappiness=0
sudo sysctl -w net.ipv4.tcp_retries2=5
tox -e charm-integration
integration-test-lxd-tls:
name: Integration tests for TLS (lxd)
Expand Down
14 changes: 4 additions & 10 deletions tests/integration/tls/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
from typing import List

from pytest_operator.plugin import OpsTest
from tenacity import retry, retry_if_not_result, stop_after_attempt, wait_exponential
from tenacity import retry, stop_after_attempt, wait_fixed, wait_random

from tests.integration.helpers import http_request


@retry(
wait=wait_exponential(multiplier=1, min=2, max=30),
wait=wait_fixed(wait=5) + wait_random(0, 5),
stop=stop_after_attempt(15),
retry_error_callback=(lambda state: state.outcome.result()),
retry=retry_if_not_result(lambda result: True if result else False),
)
async def check_security_index_initialised(ops_test: OpsTest, unit_ip: str) -> bool:
"""Returns whether the security index is initialised.
Expand All @@ -36,10 +34,8 @@ async def check_security_index_initialised(ops_test: OpsTest, unit_ip: str) -> b


@retry(
wait=wait_exponential(multiplier=1, min=2, max=30),
wait=wait_fixed(wait=5) + wait_random(0, 5),
stop=stop_after_attempt(15),
retry_error_callback=(lambda state: state.outcome.result()),
retry=retry_if_not_result(lambda result: True if result else False),
)
async def check_unit_tls_configured(ops_test: OpsTest, unit_ip: str, unit_name: str) -> bool:
"""Returns whether TLS is enabled on the specific OpenSearch unit.
Expand All @@ -57,10 +53,8 @@ async def check_unit_tls_configured(ops_test: OpsTest, unit_ip: str, unit_name:


@retry(
wait=wait_exponential(multiplier=1, min=2, max=30),
wait=wait_fixed(wait=5) + wait_random(0, 5),
stop=stop_after_attempt(15),
retry_error_callback=(lambda state: state.outcome.result()),
retry=retry_if_not_result(lambda result: True if result else False),
)
async def check_cluster_formation_successful(
ops_test: OpsTest, unit_ip: str, unit_names: List[str]
Expand Down

0 comments on commit daa9dbb

Please sign in to comment.