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

test(kuma-cp): fix wait for goroutine to be done #5638

Merged
merged 3 commits into from
Jan 11, 2023

Conversation

lukidzi
Copy link
Contributor

@lukidzi lukidzi commented Jan 10, 2023

There was some race after adding another test. Added lock for counter increment and made one test wait for the goroutine to be done before finishing the test.

  • Link to docs PR or issue --
  • Link to UI issue or PR --
  • Is the issue worked on linked? --
  • The PR does not hardcode values that might break projects that depend on kuma (e.g. "kumahq" as a image registry) --
  • The PR will work for both Linux and Windows, system specific functions like syscall.Mkfifo have equivalent implementation on the other OS --
  • Unit Tests --
  • E2E Tests --
  • Manual Universal Tests --
  • Manual Kubernetes Tests --
  • Do you need to update UPGRADE.md? --
  • Does it need to be backported according to the backporting policy? --
  • Do you need to explicitly set a > Changelog: entry here or add a ci/ label to run fewer/more tests?

Changelog skip

…in cache test

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
@lukidzi lukidzi requested review from a team, bartsmykla and lobkovilya and removed request for a team January 10, 2023 19:11
@lukidzi
Copy link
Contributor Author

lukidzi commented Jan 10, 2023

@Mergifyio backport release-2.0 release-1.8 release-1.7 release-1.6 release-1.5

@mergify
Copy link
Contributor

mergify bot commented Jan 10, 2023

backport release-2.0 release-1.8 release-1.7 release-1.6 release-1.5

✅ Backports have been created

Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

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

Would it be easier to use sync.atomic ?

Also seems like this problem also exists with getQueries

@jakubdyszkiewicz
Copy link
Contributor

Please use > Changelog skip. This may confuse users that it is a fix to the production code where in fact this is fix for the test. The alternative is to name it test: fix wait for goroutine...

@lobkovilya
Copy link
Contributor

Are you sure it fixes the problem? According to the output here it doesn't like accessing the cachedManager variable from 2 different goroutines.

@lukidzi lukidzi changed the title fix(kuma-cp): wait for goroutine to be done cache test(kuma-cp): fix wait for goroutine to be done Jan 11, 2023
…or signal

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
@lukidzi
Copy link
Contributor Author

lukidzi commented Jan 11, 2023

Are you sure it fixes the problem? According to the output here it doesn't like accessing the cachedManager variable from 2 different goroutines.

It seems that is fixed. One of the issues was that slow action was hanging in other goroutine and waiting. Now before running the next test we wait for that goroutine to close before. I've tested by running

for i in {1..100}; do go clean -testcache && make test TEST_PKG_LIST=./pkg/core/resources/manager/... ; done

and had no error.

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
@lukidzi lukidzi merged commit 31ae2bd into kumahq:master Jan 11, 2023
@lahabana
Copy link
Contributor

@lukidzi will you need to backport this too?

mergify bot pushed a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
mergify bot pushed a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
mergify bot pushed a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
mergify bot pushed a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
mergify bot pushed a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
lukidzi added a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi added a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi added a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi pushed a commit that referenced this pull request Jan 11, 2023
)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi added a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi pushed a commit that referenced this pull request Jan 11, 2023
)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi added a commit that referenced this pull request Jan 11, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit 31ae2bd)

# Conflicts:
#	pkg/core/resources/manager/cache_test.go
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi pushed a commit that referenced this pull request Jan 11, 2023
)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
mergify bot added a commit that referenced this pull request Jan 11, 2023
* fix(kuma-cp): don't cache filtered data (#5574)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit f5b8d76)
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

* fix(kuma-cp): fixed parameters

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

* fix(kuma-cp): fix conflict

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

* test(kuma-cp): fix wait for goroutine to be done (backport #5638) (#5647)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
Co-authored-by: Łukasz Dziedziak <lukidzi@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
lukidzi pushed a commit that referenced this pull request Jan 11, 2023
)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi pushed a commit that referenced this pull request Jan 11, 2023
)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
mergify bot added a commit that referenced this pull request Jan 11, 2023
* fix(kuma-cp): don't cache filtered data (#5574)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
(cherry picked from commit f5b8d76)
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

* fix(kuma-cp): fixed parameters

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

* fix(kuma-cp): fix conflict

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

* test(kuma-cp): fix wait for goroutine to be done (backport #5638) (#5646)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
Co-authored-by: Łukasz Dziedziak <lukidzi@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
lukidzi pushed a commit that referenced this pull request Jan 11, 2023
* test(kuma-cp): fix wait for goroutine to be done (backport #5638) (#5648)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
lukidzi pushed a commit that referenced this pull request Jan 11, 2023
* test(kuma-cp): fix wait for goroutine to be done (backport #5638) (#5648)

Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
bartsmykla pushed a commit to bartsmykla/kuma that referenced this pull request Jan 14, 2023
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
Signed-off-by: Bart Smykla <bartek@smykla.com>
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