Skip to content

Commit

Permalink
Dev: behave: add functional tests for pre-migration checks (jsc#PED-1…
Browse files Browse the repository at this point in the history
…1808)
  • Loading branch information
nicholasyang2022 committed Jan 9, 2025
1 parent 99c4888 commit 609bbff
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/crmsh-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,21 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration

functional_test_migration:
runs-on: ubuntu-24.04
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- name: functional test for migration
run: |
echo '{ "exec-opts": ["native.cgroupdriver=systemd"] }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker.service
$DOCKER_SCRIPT `$GET_INDEX_OF migration` && $DOCKER_SCRIPT -d && $DOCKER_SCRIPT -u `$GET_INDEX_OF migration`
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration

original_regression_test:
runs-on: ubuntu-20.04
timeout-minutes: 40
Expand Down
12 changes: 10 additions & 2 deletions test/features/steps/step_implementation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ast
import re
import time
import os
Expand All @@ -17,8 +18,8 @@


def _parse_str(text):
return text[1:-1].encode('utf-8').decode('unicode_escape')
_parse_str.pattern='".*"'
return ast.literal_eval(text)
_parse_str.pattern='"([^"]|\\")*?"'


behave.use_step_matcher("cfparse")
Expand Down Expand Up @@ -169,6 +170,13 @@ def step_impl(context, msg):
context.stderr = None


@then('Expect stdout contains snippets [{snippets:str+}].')
def step_impl(context, snippets):
for snippet in snippets:
assert_in(snippet, context.stdout)
context.stdout = None


@then('Expected regex "{reg_str}" in stdout')
def step_impl(context, reg_str):
res = re.search(reg_str, context.stdout)
Expand Down
3 changes: 0 additions & 3 deletions test/run-functional-tests
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,6 @@ deploy_ha_node() {


create_node() {
info "Loading docker image $DOCKER_IMAGE..."
docker pull $DOCKER_IMAGE &> /dev/null

for index in ${!HA_NETWORK_ARRAY[@]};do
network=${HA_NETWORK_ARRAY[$index]}
info "Create ha specific docker network \"$network\"..."
Expand Down

0 comments on commit 609bbff

Please sign in to comment.