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

Structure error handling in test_automatic_wireguard_rotation #6490

Conversation

MarkusPettersson98
Copy link
Contributor

@MarkusPettersson98 MarkusPettersson98 commented Jul 23, 2024

This PR overhauls test_automatic_wireguard_rotation to use anyhow to propagate error values instead of panicking, which is a commonly used strategy in other end-to-end tests. These are the fruits of some work investigating flakiness related to the test.


This change is Reviewable

Copy link

linear bot commented Jul 23, 2024

@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch from 45602b4 to da6e983 Compare July 23, 2024 11:40
@Serock3 Serock3 marked this pull request as draft July 25, 2024 09:19
@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch 3 times, most recently from 868fb9e to 4b62521 Compare July 29, 2024 07:53
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 4 of 4 files at r3, 1 of 1 files at r4, 1 of 1 files at r5, 4 of 4 files at r6, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @MarkusPettersson98)


test/test-manager/src/run_tests.rs line 95 at r3 (raw file):

        }

        // TODO: Log how long each test took to run.

This comment is included in commit 64bb485


test/test-manager/src/run_tests.rs line 141 at r6 (raw file):

                        .await
                {
                    log::error!("Clean up between tests failed");

This may cause merge conflict with test-manager-fixes, just FYI


test/test-manager/src/tests/account.rs line 315 at r1 (raw file):

    // listen for device daemon events until we observe the change. We have to register the event
    // listener before polling the current key to be sure we don't miss the change.
    log::info!("Verifying that wireguard key has change");

Nit: maybe fix spelling mistake while at it change -> changed


test/test-manager/src/tests/mod.rs line 84 at r3 (raw file):

    log::debug!("Cleaning up daemon in test cleanup");
    // Check if daemon should be restarted.
    // TODO: The deamon needs to be up and running after this line.

Maybe rebase on test-manager-fixes, or wait for that PR to be merged


test/test-rpc/src/client.rs line 266 at r3 (raw file):

    /// blocking execution until then.
    pub async fn stop_mullvad_daemon(&self) -> Result<(), Error> {
        // TODO: Increase timeout and log how long it took (?)

Don't forget to remove


test/test-rpc/src/client.rs line 391 at r6 (raw file):

        self.connection_handle.wait_for_server().await?;

        // TODO: Get rid of this magic number.

Don't forget the TODO

@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch from 4b62521 to d4db4c3 Compare July 29, 2024 12:28
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 7 files at r7, 9 of 9 files at r8, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @MarkusPettersson98)

@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch from d4db4c3 to 9d3d8b8 Compare July 30, 2024 14:05
Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 8 of 9 files reviewed, 3 unresolved discussions (waiting on @Serock3)


test/test-manager/src/run_tests.rs line 95 at r3 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

This comment is included in commit 64bb485

Yes


test/test-manager/src/run_tests.rs line 141 at r6 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

This may cause merge conflict with test-manager-fixes, just FYI

Yeah, let's merge that first. I'll deal with the mess later :)


test/test-manager/src/tests/account.rs line 315 at r1 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

Nit: maybe fix spelling mistake while at it change -> changed

Done


test/test-manager/src/tests/mod.rs line 84 at r3 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

Maybe rebase on test-manager-fixes, or wait for that PR to be merged

Awaiting that PR to be merged


test/test-rpc/src/client.rs line 391 at r6 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

Don't forget the TODO

Done

@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch 3 times, most recently from 82cf943 to 74c1de5 Compare August 1, 2024 13:41
@MarkusPettersson98 MarkusPettersson98 marked this pull request as ready for review August 2, 2024 08:01
@MarkusPettersson98 MarkusPettersson98 marked this pull request as draft August 2, 2024 08:05
@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch from 29cb388 to 3bab42c Compare August 12, 2024 07:06
@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch 4 times, most recently from f52855e to 7987b97 Compare August 12, 2024 14:57
@MarkusPettersson98 MarkusPettersson98 marked this pull request as ready for review August 12, 2024 14:57
@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch from 7987b97 to a81e56a Compare August 12, 2024 14:58
Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 12 files reviewed, 4 unresolved discussions (waiting on @Serock3)


test/test-manager/src/tests/account.rs line 265 at r11 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

I think I like my version of this comment better (used to be above the creation of the event listener). Was there something about it you disagreed with?

Added it back, I don't see the point in not having it there tbh 😊


test/test-manager/src/tests/mod.rs line 83 at r11 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

I'd avoid touching this fn if I were you, it's going to conflict with my test-manager-fixes PR

Yup, moving those changes to a separate PR

Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r9, 2 of 4 files at r10, 10 of 12 files at r11, 2 of 2 files at r12, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Make the following changes:
- Propagate the device error instead of throwing away the error
information by transforming it into an `Option`.
- Increase daemon restart timeout
- Convert catch-all arm to exhaustive check
@MarkusPettersson98 MarkusPettersson98 force-pushed the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch from 55d5965 to 177f655 Compare August 14, 2024 06:15
@MarkusPettersson98 MarkusPettersson98 merged commit 08de199 into main Aug 14, 2024
52 checks passed
@MarkusPettersson98 MarkusPettersson98 deleted the test_automatic_wireguard_rotation-fails-due-to-timeout-des-1094 branch August 14, 2024 06:32
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.

2 participants