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

Add feature indicator test #6648

Merged
merged 2 commits into from
Aug 21, 2024
Merged

Add feature indicator test #6648

merged 2 commits into from
Aug 21, 2024

Conversation

Serock3
Copy link
Contributor

@Serock3 Serock3 commented Aug 20, 2024

Add simple test that modifies the settings and endpoint with one variable at a time and verifies that the corresponding indicator is activated.

Fixes: DES-1159


This change is Reviewable

@Serock3 Serock3 self-assigned this Aug 20, 2024
@Serock3 Serock3 force-pushed the feature-indicator-tests branch from 318d41e to c4c4c54 Compare August 20, 2024 14:18
Copy link
Contributor

@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.

Nice! If we could fail the test when a new feature indicator (which is not yet covered by this test) is added, do you think that would add additional value? 😊

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Serock3)


mullvad-types/src/features.rs line 230 at r1 (raw file):

            compute_feature_indicators(&settings, &endpoint),
            expected_indicators
        );

Is the intent to enable ad-blocking DNS twice?:)

Code quote:

        settings
            .tunnel_options
            .dns_options
            .default_options
            .block_ads = true;

        expected_indicators
            .0
            .insert(FeatureIndicator::DnsContentBlockers);

        assert_eq!(
            compute_feature_indicators(&settings, &endpoint),
            expected_indicators
        );

        settings
            .tunnel_options
            .dns_options
            .default_options
            .block_ads = true;

        expected_indicators
            .0
            .insert(FeatureIndicator::DnsContentBlockers);

        assert_eq!(
            compute_feature_indicators(&settings, &endpoint),
            expected_indicators
        );

@Serock3 Serock3 force-pushed the feature-indicator-tests branch from c4c4c54 to 260fd26 Compare August 21, 2024 06:59
Copy link
Contributor Author

@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.

Done

Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)


mullvad-types/src/features.rs line 230 at r1 (raw file):

Previously, MarkusPettersson98 (Markus Pettersson) wrote…

Is the intent to enable ad-blocking DNS twice?:)

Whoops

@Serock3 Serock3 force-pushed the feature-indicator-tests branch from 260fd26 to 883fa76 Compare August 21, 2024 07:02
Copy link
Contributor

@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.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Serock3)


mullvad-types/src/features.rs line 324 at r2 (raw file):

        // !If this match statement fails to compile, it means that a new feature indicator has been
        // added. Please update this test to include the new feature indicator.

Nit Why the leading bang (!)? 😊

Code quote:

        // !If this match statement fails to compile, it means that a new feature indicator has been
        // added. Please update this test to include the new feature indicator.

Copy link
Contributor Author

@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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)


mullvad-types/src/features.rs line 324 at r2 (raw file):

Previously, MarkusPettersson98 (Markus Pettersson) wrote…

Nit Why the leading bang (!)? 😊

It's because my IDE makes the entire comment red 🙈 Not sure if that's some unofficial standard, but it made it stick out a lot more for me

Copy link
Contributor Author

@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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)


mullvad-types/src/features.rs line 324 at r2 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

It's because my IDE makes the entire comment red 🙈 Not sure if that's some unofficial standard, but it made it stick out a lot more for me

A bit silly sure, I can remove it if you want

Copy link
Contributor

@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: all files reviewed, 1 unresolved discussion (waiting on @Serock3)


mullvad-types/src/features.rs line 324 at r2 (raw file):

Previously, Serock3 (Sebastian Holmin) wrote…

A bit silly sure, I can remove it if you want

Oh, maybe. I've never seen it used before 🤔 For that purpose there is the NOTE: convention* which is failry widespread. I would prefer that one, since my editor doesn't pick up the // !..-formatting 😊

@Serock3 Serock3 force-pushed the feature-indicator-tests branch from 883fa76 to ce96299 Compare August 21, 2024 09:26
Copy link
Contributor Author

@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.

Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @MarkusPettersson98)


mullvad-types/src/features.rs line 324 at r2 (raw file):

Previously, MarkusPettersson98 (Markus Pettersson) wrote…

Oh, maybe. I've never seen it used before 🤔 For that purpose there is the NOTE: convention* which is failry widespread. I would prefer that one, since my editor doesn't pick up the // !..-formatting 😊

I agree that NOTE: is more widespread, switched to that

Copy link
Contributor

@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.

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@dlon dlon force-pushed the feature-indicator-tests branch from ce96299 to e2c7d16 Compare August 21, 2024 15:53
@dlon dlon merged commit 0c3f00f into main Aug 21, 2024
47 checks passed
@dlon dlon deleted the feature-indicator-tests branch August 21, 2024 15:55
Copy link

linear bot commented Aug 23, 2024

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.

3 participants