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 concurrent issue during bundle file concurrent generation testing #6043

Conversation

JohnNiang
Copy link
Member

@JohnNiang JohnNiang commented Jun 5, 2024

What type of PR is this?

/kind failing-test
/area core
/milestone 2.17.x

What this PR does / why we need it:

I wrongly invoked Arraylist#add(probes) method in multi threads. So the unit test was unstable and might encounter the problem as follows:

Expected :1
Actual   :0
<Click to see difference>

org.opentest4j.AssertionFailedError: expected: <1> but was: <0>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:166)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:632)
	at run.halo.app.core.extension.service.impl.PluginServiceImplTest$BundleCacheTest.concurrentComputeBundleFileIfAbsent(PluginServiceImplTest.java:460)

See https://github.com/halo-dev/halo/actions/runs/9382059472/job/25832681545 for more.

This PR moves the invocation outside thread tasks.

Does this PR introduce a user-facing change?

None

@f2c-ci-robot f2c-ci-robot bot added kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. release-note-none Denotes a PR that doesn't merit a release note. labels Jun 5, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.17.x milestone Jun 5, 2024
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Jun 5, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from guqing and wan92hen June 5, 2024 16:26
Copy link

sonarqubecloud bot commented Jun 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.2% Duplication on New Code

See analysis details on SonarCloud

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.47%. Comparing base (5fdf6c0) to head (b98e785).
Report is 227 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6043      +/-   ##
============================================
- Coverage     56.91%   56.47%   -0.44%     
- Complexity     3319     3541     +222     
============================================
  Files           587      622      +35     
  Lines         18968    20961    +1993     
  Branches       1401     1478      +77     
============================================
+ Hits          10795    11838    +1043     
- Misses         7594     8523     +929     
- Partials        579      600      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jun 6, 2024
Copy link

f2c-ci-robot bot commented Jun 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 6, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit e446054 into halo-dev:main Jun 6, 2024
8 checks passed
@JohnNiang
Copy link
Member Author

/cherry-pick release-2.16

@halo-dev-bot
Copy link
Collaborator

@JohnNiang: new pull request created: #6045

In response to this:

/cherry-pick release-2.16

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@JohnNiang JohnNiang deleted the bug/concurrent-test-against-plugin-service branch June 6, 2024 06:14
f2c-ci-robot bot pushed a commit that referenced this pull request Jun 6, 2024
…eration testing (#6045)

This is an automated cherry-pick of #6043

/assign JohnNiang

```release-note
None
```
ruibaby pushed a commit to ruibaby/halo that referenced this pull request Jun 6, 2024
…halo-dev#6043)

#### What type of PR is this?

/kind failing-test
/area core
/milestone 2.17.x

#### What this PR does / why we need it:

I wrongly invoked `Arraylist#add`(probes) method in multi threads. So the unit test was unstable and might encounter the problem as follows:

```java
Expected :1
Actual   :0
<Click to see difference>

org.opentest4j.AssertionFailedError: expected: <1> but was: <0>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:166)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:161)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:632)
	at run.halo.app.core.extension.service.impl.PluginServiceImplTest$BundleCacheTest.concurrentComputeBundleFileIfAbsent(PluginServiceImplTest.java:460)
```

See https://github.com/halo-dev/halo/actions/runs/9382059472/job/25832681545 for more.

This PR moves the invocation outside thread tasks.

#### Does this PR introduce a user-facing change?

```release-note
None
```
@ruibaby ruibaby modified the milestones: 2.17.x, 2.17.0 Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants