Skip to content

chore(tests): remove dead code and hardcoded sleeps#2900

Open
p-targowicz wants to merge 6 commits into
masterfrom
chore/QA-1616-remove-dead-code
Open

chore(tests): remove dead code and hardcoded sleeps#2900
p-targowicz wants to merge 6 commits into
masterfrom
chore/QA-1616-remove-dead-code

Conversation

@p-targowicz
Copy link
Copy Markdown
Contributor

@p-targowicz p-targowicz commented May 19, 2026

  • Remove extra/travis-testing/ (Travis CI legacy, repo uses GitLab CI)
  • Replace time.sleep() calls in test_mender_connect.py and test_filetransfer.py that wait for mender-connect reconnection with wait_for_connect(), which polls the management API via redo.retrier
  • attempt to fix test_in_poor_network_environment

QA-1616, QA-1638

@p-targowicz p-targowicz requested a review from a team as a code owner May 19, 2026 06:59
@mender-test-bot
Copy link
Copy Markdown
Contributor

@p-targowicz, start a full integration test pipeline with:

  • mentioning me and start integration pipeline

my commands and options

You can prevent me from automatically starting CI pipelines:

  • if your pull request title starts with "[NoCI] ..."

You can trigger a client pipeline on multiple prs with:

  • mentioning me and start client pipeline --pr mender/127 --pr mender-connect/255

You can trigger a client pipeline for a specific Mender Client release with:

  • mentioning me and start client pipeline --release 6.0.x (can be given multiple times)
  • by default, a pipeline is triggered for each supported release the component is a part of

You can trigger GitHub->GitLab branch sync with:

  • mentioning me and sync

You can print PR statistics for a repository with:

  • mentioning me and print fast pr stats (Team stats only)
  • mentioning me and print full pr stats (Detailed report)
  • options: --repo <repo>, --team <name>, --all-repos, --exclude-drafts, --exclude-user <user>
  • mentioning me and print full pr stats --repo mender --all-repos --exclude-drafts

You can cherry pick to a given branch or branches with:

  • mentioning me and:
 cherry-pick to:
 * 1.0.x
 * 2.0.x

@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2536252553

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from 5301a8b to f4fc250 Compare May 19, 2026 07:40
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2536354903

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch 5 times, most recently from 94ab95e to c27ba83 Compare May 19, 2026 12:05
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2537195101

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2537196703

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from c27ba83 to c6a426a Compare May 19, 2026 20:09
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2538446691

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from c6a426a to e231fb0 Compare May 19, 2026 20:24
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2538886406

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch 2 times, most recently from 8bfe6db to 5048872 Compare May 20, 2026 09:17
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2539937154

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from 5048872 to 9fc9e6a Compare May 21, 2026 19:59
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2544594882

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from 9fc9e6a to a0c45f2 Compare May 21, 2026 21:43
@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2550881136

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2550970314

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2551098384

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2551448563

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2551510907

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

@elkoniu
Copy link
Copy Markdown
Contributor

elkoniu commented May 25, 2026

@p-targowicz I think some merge commits slipped into this PR together with "normal" commits.

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from 47a82fd to 890f1ac Compare May 26, 2026 08:41
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@p-targowicz I think some merge commits slipped into this PR together with "normal" commits.

done @elkoniu

Copy link
Copy Markdown
Contributor

@danielskinstad danielskinstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I haven't looked closely at the actual changes, but my immediate thought is that this should be split into multiple commits. Could you do that and ping me when it's ready to review?

@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from 890f1ac to fd6d24a Compare May 26, 2026 12:37
Ticket: QA-1616
Signed-off-by: Patryk Targowicz <patryk.targowicz@northern.tech>
Ticket: QA-1616
Signed-off-by: Patryk Targowicz <patryk.targowicz@northern.tech>
Remove the console handler from setup_test_logger so DEBUG output no
longer appears in the GitLab trace or pytest-html "Captured Stderr".
All logs still go to mender_test_logs/<test>.log at DEBUG level.
Add log_level = WARNING to pytest.ini to suppress pytest's own
"Captured Log" section in the HTML report.
Move _debug_log_containers_logs() call to conftest exception hook so
container logs are captured on failure even when teardown is skipped.

Changelog: None
Ticket: QA-1616
Signed-off-by: Patryk Targowicz <patryk.targowicz@northern.tech>
…ersions

websockets removed InvalidStatusCode in favour of InvalidHandshake.

Changelog: None
Ticket: QA-1616
Signed-off-by: Patryk Targowicz <patryk.targowicz@northern.tech>
… tests

Switch iptables DROP to REJECT in test_in_poor_network_environment so
mender-connect detects the disconnect immediately rather than waiting
for TCP RTO (~60s). Replace the 128s sleep pairs with wait_for_connect
(attempts=30, ~150s max) to accommodate exponential backoff after
repeated failures.

Add an attempts parameter to wait_for_connect (default 12) and set
sleepscale=1 so the interval stays fixed at 5s instead of growing.

Add a retry loop for startShell() in the reconnect test because the
WebSocket reconnects before the shell service is fully ready.

Remove the redundant 4s sleep before wait_for_connect in set_limits().

Changelog: None
Ticket: QA-1616
Ticket: QA-1638
Signed-off-by: Patryk Targowicz <patryk.targowicz@northern.tech>
Remove do_test_ok_preauth_and_remove and do_test_fail_preauth_existing
from test_preauth.py along with their callers.

Remove the dead outer tempfile block in test_mtls_enterprise_hsm that
shadowed the inner block without being used.

Replace list(set([device["id"] for device in ...])) with a plain list
comprehension or direct get_devices_status() call. Device IDs are
already unique so the set() conversion was unnecessary and silently
changed the element type from dict to str.

Replace fixed-time sleeps with redo.retrier polling loops in
test_configuration.py, test_inventory.py, test_preauth.py, and
test_monitor_client.py.

Add poll_for_alert_state() helper to TestMonitorClientEnterprise to
replace the pattern of sleep + immediate assert.

Ticket: QA-1616
Ticket: QA-1638
Signed-off-by: Patryk Targowicz <patryk.targowicz@northern.tech>
@p-targowicz p-targowicz force-pushed the chore/QA-1616-remove-dead-code branch from fd6d24a to 1cd9e24 Compare May 26, 2026 13:00
@p-targowicz
Copy link
Copy Markdown
Contributor Author

@danielskinstad done, splitted into commits

@p-targowicz
Copy link
Copy Markdown
Contributor Author

@mender-test-bot start integration pipeline

@mender-test-bot
Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2558259703

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2900/head
RUN_TESTS_FULL_INTEGRATION true

Copy link
Copy Markdown
Contributor

@danielskinstad danielskinstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good from what I can see. I think there's more to remove, though. This one I linked in the ticket: https://github.com/mendersoftware/integration/tree/master/extra/legacy-clients-testing, but there is probably more in the extra/ dir that can be cleaned up

docker_env.device.run("apt-get install -y iptables")
docker_env.device.run(
"iptables -A OUTPUT -j DROP --destination docker.mender.io"
"iptables -A OUTPUT -j REJECT --destination docker.mender.io"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will let Peter comment on this test, as there is a ticket in progress for it

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants