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

[SUREFIRE-2025] Updated abstractions which helps associating systemProperties() with a test context #475

Merged
merged 1 commit into from Feb 25, 2022

Conversation

Tibor17
Copy link
Contributor

@Tibor17 Tibor17 commented Feb 24, 2022

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace SUREFIRE-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean install).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Comment on lines 40 to 41
void systemProperties( Map<String, String> sysProps );
void systemProperties( Map<String, String> sysProps, RunMode runMode, Long testRunId );
Copy link
Member

Choose a reason for hiding this comment

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

method name is not descriptive .... what does do .. read/write/verify properties?
Now new params - what for?

documentation is needed

Copy link
Member

Choose a reason for hiding this comment

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

@Tibor17 can you add some documentation for this method ... or you have such plan?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree and so I have added the Javadoc, pls see the commit 2840bfa.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The testRunId says - this is the test set.
The runMode says - normal mode, or re-run.

public void systemProperties( Map<String, String> sysProps )
public void systemProperties( Map<String, String> sysProps, RunMode rm, Long testRunId )
Copy link
Member

Choose a reason for hiding this comment

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

we already have field with the same name and type runMode
why not use filed from instance?

Copy link
Member

Choose a reason for hiding this comment

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

field runMode sometime is used ... sometime is overridden by method params in this class
line: 389, 419

Copy link
Contributor Author

@Tibor17 Tibor17 Feb 24, 2022

Choose a reason for hiding this comment

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

The fields runMode will be deleted in ForkinRunListener and EventChannelEncoder.
This PR has only prepared changes in one method signature. The implementation of this abstract method comes right after. This PR is only an intermediate step.

Copy link
Contributor Author

@Tibor17 Tibor17 Feb 24, 2022

Choose a reason for hiding this comment

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

You'r right, the runMode as a test status should not be in 3 classes. It should be only in one, e.g. in the:
JUnit4RunListener which implements framework's listener org.junit.runner.notification.RunListener.

Copy link
Member

Choose a reason for hiding this comment

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

ok, so it is next issue to clean up it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly

target.systemProperties( report.getSystemProperties() );
target.systemProperties( report.getSystemProperties(), null, null );
Copy link
Member

Choose a reason for hiding this comment

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

In this class we have filed runMode

  • why not used here?
  • why is not propagated to target?

Copy link
Contributor Author

@Tibor17 Tibor17 Feb 24, 2022

Choose a reason for hiding this comment

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

I did split the entire work of SUREFIRE-1860 into 5 pieces.
The line you are asking for is in my IDEA:
target.systemProperties( report.getSystemProperties(), report.getRunMode(), report.getTestRunId() );
Both getters will come in the next PR right after, see SUREFIRE-2015

Copy link
Contributor Author

@Tibor17 Tibor17 Feb 24, 2022

Choose a reason for hiding this comment

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

The target is not JUnit's RunListener implementation.
Only the framework's listener may have this data runMode and be "stateful".
The target is a pure encoder, and so it should not have any notion about stateful data regarding test status. It should only receive data, encode it, and send it to a channel.

Copy link
Member

Choose a reason for hiding this comment

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

So what for EventChannelEncoder has runMode field?

Copy link
Contributor Author

@Tibor17 Tibor17 Feb 25, 2022

Choose a reason for hiding this comment

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

runMode field will be removed in the next PR.
This PR only changed some method signatures in the same manner with the previous one.
After this the implementation would come in PR.

@Tibor17
Copy link
Contributor Author

Tibor17 commented Feb 25, 2022

@slawekjaranowski
Yesterday I have realized that I extended TestSetReportEntry with system properties in the version 2.20.1. See this:

public interface TestSetReportEntry extends ReportEntry
{
    Map<String, String> getSystemProperties();
}

Due to the system properties are sent only when the test set has finished. Pls notice that the XML report contains these system properties from the end of test set. Therefore I made these consequent changes in the last commit c33024e. The method we spoke above is gone and the functionality is intrisic down in the encoder due to the TestSetReportEntry already contains the system props on the event call testSetCompleted(TestSetReportEntry).

…operties() with a test context

added Javadoc
TestSetReportEntry already contains system properties and systemProperties() can be removed in MasterProcessChannelEncoder
@Tibor17 Tibor17 merged commit 64f0fde into master Feb 25, 2022
@Tibor17 Tibor17 changed the title [SUREFIRE-2025] Updated abstractions which helps associating systemProperties() with a test [SUREFIRE-2025] Updated abstractions which helps associating systemProperties() with a test context Feb 25, 2022
@Tibor17 Tibor17 deleted the SUREFIRE-2025 branch February 25, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants