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

Fix unstable test + Add new test #250

Merged
merged 2 commits into from
Oct 16, 2023

Conversation

NikitaSkrynnik
Copy link
Contributor

Description

Fixed unstable test TestAllSourcesWithFileOutput. Also added a new test which checks that if collector receives several notification messages but no prefixes change it won't write the same prefixes to a file several times.

Issue

#180

Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
internal/prefixcollector/collector_file_output_test.go Outdated Show resolved Hide resolved
@@ -112,14 +148,14 @@ func (eps *ExcludedPrefixesSuite) testCollectorWithFileOutput(ctx context.Contex
eps.T().Fatalf("Error transforming yaml to prefixes: %v", err)
}

eps.Require().LessOrEqual(modified, len(sources)*2)
Copy link
Member

Choose a reason for hiding this comment

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

How does we calculate the modification count?

Also, seems like actual and expected should be swaped (see at input params of the function)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've chosen this value because for each file write there may be two nsnotify.Write events maximum. So for each source we need to have at least two possible write events.

@denis-tingaikin denis-tingaikin self-requested a review October 10, 2023 13:25
Signed-off-by: Nikita Skrynnik <nikita.skrynnik@xored.com>
@denis-tingaikin denis-tingaikin merged commit c7b67bf into networkservicemesh:main Oct 16, 2023
12 checks passed
nsmbot pushed a commit to networkservicemesh/deployments-k8s that referenced this pull request Oct 16, 2023
…d-exclude-prefixes-k8s@main

PR link: networkservicemesh/cmd-exclude-prefixes-k8s#250

Commit: c7b67bf
Author: Denis Tingaikin
Date: 2023-10-16 21:46:16 +0300
Message:
  - Merge pull request #250 from NikitaSkrynnik/fix-test
Signed-off-by: NSMBot <nsmbot@networkservicmesh.io>
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