Skip to content

Conversation

@VishalMCF
Copy link
Contributor

@VishalMCF VishalMCF commented Nov 16, 2023

Fixes #4547 .

Motivation

OpenFunctionConnector module was lacking test cases.

Modifications

Added test file for OpenFunction Source Connector. Explored SpringSourceConnector and based on that the changes were added.

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@VishalMCF
Copy link
Contributor Author

@yanrongzhen Please review the pull request. If it is okay based on that I will add changes for OpenFunctionSinkConnectorTest

public class OpenFunctionSourceConnectorTest {

@Spy
private OpenFunctionSourceConnector connector;
Copy link
Member

Choose a reason for hiding this comment

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

This @Spy annotation is redundant, because you completely manually constructed connector without simulating it. Because @Spy is redundant, @ExtendWith(MockitoExtension.class) also becomes redundant.

Copy link
Contributor Author

@VishalMCF VishalMCF Nov 16, 2023

Choose a reason for hiding this comment

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

@pandaapo I have made the changes as per your previous comment. The only difference is not that with @SPY annotation I didn't need to use "new" Operator and also removed the dependencies from the build.gradle file

Object actualMessage = String.valueOf(connectRecords.get(i).getData());
String expectedMessage = "testMessage" + i;
Assertions.assertEquals(expectedMessage, actualMessage);
}
Copy link
Member

Choose a reason for hiding this comment

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

It is better to call stop () at the last, although it is currently an empty method. Additionally, please fix the checkstyle error prompted by CI.

Copy link
Member

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

@VishalMCF Please fix CI error

@VishalMCF
Copy link
Contributor Author

@mxsm Is it possible to see the test.html file to see what errors are happening? I have imported the checkstyle.xml and when I run ./gradlew check it works fine in my system.

@codecov
Copy link

codecov bot commented Nov 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (715423c) 16.81% compared to head (9d13884) 16.69%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4561      +/-   ##
============================================
- Coverage     16.81%   16.69%   -0.12%     
- Complexity     1627     1634       +7     
============================================
  Files           749      764      +15     
  Lines         28682    28968     +286     
  Branches       2487     2500      +13     
============================================
+ Hits           4823     4837      +14     
- Misses        23406    23676     +270     
- Partials        453      455       +2     

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

@pandaapo
Copy link
Member

pandaapo commented Nov 18, 2023

@mxsm Is it possible to see the test.html file to see what errors are happening? I have imported the checkstyle.xml and when I run ./gradlew check it works fine in my system.

The following errors were reported by CI earlier, and they were actually checkstyle errors. You have fixed them in new commits.

* What went wrong:
476 actionable tasks: 448 executed, 28 up-to-date
Execution failed for task ':eventmesh-connectors:eventmesh-connector-openfunction:checkstyleTest'.
> A failure occurred while executing org.gradle.api.plugins.quality.internal.CheckstyleAction
   > Checkstyle rule violations were found. See the report at: file:///home/runner/work/eventmesh/eventmesh/eventmesh-connectors/eventmesh-connector-openfunction/build/reports/checkstyle/test.html
     Checkstyle files with violations: 1
     Checkstyle violations by severity: [warning:1]

@VishalMCF
Copy link
Contributor Author

@mxsm I have made the requested changes.

@xwm1992 xwm1992 changed the title Added test for OpenFunction Source Connector [ISSUE #4547] Add unit test for OpenFunctionSourceConnector. Nov 20, 2023
Copy link
Member

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

LGTM

@mxsm mxsm merged commit 4c9f0e1 into apache:master Nov 22, 2023
@xwm1992 xwm1992 added this to the 1.10 milestone Dec 12, 2023
xuhongjia pushed a commit to Deckers-Ohana/eventmesh that referenced this pull request Mar 13, 2025
…pache#4561)

* Added test for OpenFunction Source Connector

* Removed Redundant @SPY annnotation

* WIP resolved checkstyle errors
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.

[Unit Test] Add unit test for OpenFunctionSourceConnector.

4 participants