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 unit test for PipelineJobCenter #28879

Merged
merged 6 commits into from
Nov 2, 2023
Merged

Conversation

HarshSawarkar
Copy link
Contributor

@HarshSawarkar HarshSawarkar commented Oct 27, 2023

Fixes #28542 .

Changes proposed in this pull request:

Added unit tests for PipelineJobCenter to test its public functions to improve unit test coverage. Methods: addJob, isJobExisting, getJob, getJobItemContext, getShardingItems.

Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.

@HarshSawarkar
Copy link
Contributor Author

Hi @zhaojinchao95 Please can you guide me with these checks

  1. CI / CI - Compile by JDK 11 and Run on JDK 8 (pull_request)
  2. Required - Check / Check - CheckStyle (pull_request)
  3. Required - Check / Check - Spotless (pull_request)
  4. Required - Check / Check - License (pull_request)

I have followed all the guidelines to setup and run the project locally.There are some issues in pom.xml file which I tried to resolve but no luck!

Here are some snapshots of the error I am facing

image

image

A similar issue was there for YAMLEnginetest.assertMarshal but i resovled it
image

Has anyone faced the same issue above??? Please guide.

@sandynz
Copy link
Contributor

sandynz commented Oct 30, 2023

Hi @HarshSawarkar , about newline related errors, you could ignore it for now, we'll try to fix it. Thanks for your feedback.

About GitHub CI errors:

CI / CI - Compile by JDK 11 and Run on JDK 8 (pull_request)

There's an error of PipelineJobCenterTest, you could run on local machine to test and fix it:

Error:  org.apache.shardingsphere.data.pipeline.core.job.PipelineJobCenterTest.getJobItemContext -- Time elapsed: 0.157 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <Mock for PipelineJobItemContext, hashCode: 1250956357> but was: <Optional[Mock for PipelineJobItemContext, hashCode: 1250956357]>
	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:182)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
	at org.apache.shardingsphere.data.pipeline.core.job.PipelineJobCenterTest.getJobItemContext(PipelineJobCenterTest.java:57)

Required - Check / Check - CheckStyle (pull_request)

These ones is caused by checkstyle, you could follow Code of Conduct:

If using IDEA, you can import the recommended src/resources/code-style-idea.xml

And then format your code.

Required - Check / Check - Spotless (pull_request)

You could follow Code of Conduct:

Through the uniform code style of spotless, execute the ./mvnw spotless:apply -Pcheck formatted code.

Required - Check / Check - License (pull_request)

You could copy a license header from another java file and add it into PipelineJobCenterTest.java.

Other suggestions will be commented on PR review.

@HarshSawarkar
Copy link
Contributor Author

Thanks @sandynz for your response,will look into it.

@HarshSawarkar HarshSawarkar requested a review from sandynz October 30, 2023 13:02
@HarshSawarkar
Copy link
Contributor Author

Hey @sandynz I have made the changes to the code.Can you please review it?

@HarshSawarkar HarshSawarkar requested a review from sandynz October 31, 2023 12:34
@HarshSawarkar
Copy link
Contributor Author

Hi @sandynz I have made the changes.Can you please review it again?

@sandynz
Copy link
Contributor

sandynz commented Nov 1, 2023

Hi @sandynz I have made the changes.Can you please review it again?

Hi @HarshSawarkar , there's checkstyle error in CI, you could follow error details in Check - CheckStyle to fix it.

If you've installed CheckStyle plugin in IDE, then you could verify it on your local machine.

@sandynz sandynz changed the title 28542 Add unit test for PipelineJobCenter Nov 1, 2023
@HarshSawarkar
Copy link
Contributor Author

Hey @sandynz

Hi @sandynz I have made the changes.Can you please review it again?

Hi @HarshSawarkar , there's checkstyle error in CI, you could follow error details in Check - CheckStyle to fix it.

If you've installed CheckStyle plugin in IDE, then you could verify it on your local machine.

Thanks for your response.I am looking into it.

@HarshSawarkar
Copy link
Contributor Author

Can you please review it again @sandynz ?

@HarshSawarkar HarshSawarkar requested a review from sandynz November 1, 2023 12:50
@sandynz sandynz merged commit dd44eb0 into apache:master Nov 2, 2023
15 checks passed
@sandynz
Copy link
Contributor

sandynz commented Nov 2, 2023

Can you please review it again @sandynz ?

Nice. Merged

@HarshSawarkar
Copy link
Contributor Author

@sandynz Thanks for your support , looking forward to work on more issues.

@HarshSawarkar HarshSawarkar deleted the 28542 branch November 3, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit test for PipelineJobCenter
3 participants