Skip to content

[BUG_FIX]fix multi-threaded tests error.#3044

Merged
davidzollo merged 4 commits intoapache:devfrom
CalvinKirs:fix_mock_test_error
Jun 23, 2020
Merged

[BUG_FIX]fix multi-threaded tests error.#3044
davidzollo merged 4 commits intoapache:devfrom
CalvinKirs:fix_mock_test_error

Conversation

@CalvinKirs
Copy link
Copy Markdown
Member

Tips

What is the purpose of the pull request

When I ut, he will accidentally get the following error in the concurrent situation(The specific error message can be found on this link:https://github.com/apache/incubator-dolphinscheduler/pull/3027/checks?check_run_id=799051935)
queryUserQueueByProcessInstanceId() should return String


If you're unsure why you're getting above error read on.
Due to the nature of the syntax above problem might occur because:

  1. This exception might occur in wrongly written multi-threaded tests.
    Please refer to Mockito FAQ on limitations of concurrency testing.
  2. A spy is stubbed using when(spy.foo()).then() syntax. It is safer to stub spies -
    • with doReturn|Throw() family of methods. More in javadocs for Mockito.spy() method.

I fixed it to avoid affecting subsequent pr submissions
Related documents can be seen:https://groups.google.com/forum/?fromgroups#!topic/mockito/9WUvkhZUy90

Verify this pull request

This pull request is already covered by existing tests, such as (please describe tests).

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

warning The version of Java (1.8.0_252) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11.
Read more here

Copy link
Copy Markdown
Contributor

@davidzollo davidzollo left a comment

Choose a reason for hiding this comment

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

+1

@davidzollo davidzollo merged commit ad28c65 into apache:dev Jun 23, 2020
liuhuijuan-bx pushed a commit to tss-baosight/incubator-dolphinscheduler that referenced this pull request Jun 25, 2020
* fix  test mock error

* fix  test mock error
davidzollo pushed a commit that referenced this pull request Jun 25, 2020
…ies (#3041)

* fix release for nginx bug

* add state (#3040)

Co-authored-by: mzjnumber1@163.com <mzjnumber1@163.com>

* [BUG_FIX]fix  multi-threaded tests error. (#3044)

* fix  test mock error

* fix  test mock error

Co-authored-by: muzhongjiang <mu_zhongjiang@163.com>
Co-authored-by: mzjnumber1@163.com <mzjnumber1@163.com>
Co-authored-by: CalvinKirs <acm_master@163.com>
lenboo pushed a commit that referenced this pull request Jun 30, 2020
…ies (#3041)

* fix release for nginx bug

* add state (#3040)

Co-authored-by: mzjnumber1@163.com <mzjnumber1@163.com>

* [BUG_FIX]fix  multi-threaded tests error. (#3044)

* fix  test mock error

* fix  test mock error

Co-authored-by: muzhongjiang <mu_zhongjiang@163.com>
Co-authored-by: mzjnumber1@163.com <mzjnumber1@163.com>
Co-authored-by: CalvinKirs <acm_master@163.com>
@CalvinKirs CalvinKirs deleted the fix_mock_test_error branch July 16, 2020 11:58
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