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

IGNITE-5732 Provide API to test compatibility with old releases #2410

Closed
wants to merge 51 commits into from

Conversation

daradurvs
Copy link
Member

@daradurvs daradurvs commented Aug 7, 2017

Special module contains testing framework which provides methods for testing backward compatibility.
It allows to start Ignite-cluster in multiversion mode. It means that nodes with different build version is allowed to join topology.

boolean found = ignite.cluster().node(syncId) != null;

if (found)
X.println(IgniteCompatibilityAbstractTest.SYNCHRONIZATION_LOG_MESSAGE_JOINED + id);
Copy link
Contributor

@voipp voipp Sep 21, 2017

Choose a reason for hiding this comment

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

may be print all messages to some logger, so user can define its own way to print messages.

Copy link
Member Author

@daradurvs daradurvs Sep 21, 2017

Choose a reason for hiding this comment

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

No, I can't do it. I only can grab a process output of separate JVM.
It doesn't matter which logger will be used by user.

Copy link
Member Author

Choose a reason for hiding this comment

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

By the same token, exchange doesn't start before cluster activation.


assert GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
return ignite.cluster().node(syncId) != null;
Copy link
Contributor

Choose a reason for hiding this comment

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

may be add awaitPartitionMapExchange()

Copy link
Member Author

@daradurvs daradurvs Sep 21, 2017

Choose a reason for hiding this comment

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

There is a reverse synchronization in case of starting the first node in local JVM when there are nodes in another JVM.

Copy link
Member Author

Choose a reason for hiding this comment

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

By the same token, exchange doesn't start before cluster activation.


exec("mvn dependency:get -Dartifact=" + artifact);

X.println("Download is finished");
Copy link
Contributor

Choose a reason for hiding this comment

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

why println not logging

if (!defaultDBWorkDirectoryIsEmpty())
deleteDefaultDBWorkDirectory();

assert defaultDBWorkDirectoryIsEmpty() : "DB work directory is not empty.";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we assert this check?
Can asserts be disabled in test run?

*/
public void testNodeStartByOldVersionPersistenceData() throws Exception {
try {
startGrid(1, "2.2.0", new PostConfigurationClosure(), new PostActionClosure());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check compatibility for implicit version?
For example - run test with nodes X-n versions?
2.2.0
2.1.0 (or 2.1.5 if it previous to 2.2.0)
2.0.0 etc.

Can we provide startPreviuousVersionGrid method for X-1 compatibility tests?

@Override protected void beforeTest() throws Exception {
super.beforeTest();

if (!defaultDBWorkDirectoryIsEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems that we should move beforeTest and afterTest to some abstract class or utility method.

Copy link
Member Author

Choose a reason for hiding this comment

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

This test class will be removed.
But, I agree we should provide PersistenceAbstractClasss, thanks!


assertEquals(1, topologyVersion(ignite));

startGrid("testMultiVersion", "2.3.0-SNAPSHOT", new PostConfigurationClosure());
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like the idea to specify explicit Ignite version.
In that case we need updated test file with some script on every next version.
Can we use current version or something similar?

Copy link
Member Author

Choose a reason for hiding this comment

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

This test will be removed.
There is framework-self-test with a package which installed in the Maven local repositoty.


assertEquals(1, topologyVersion(ignite));

startGrid(1, "2.3.0-SNAPSHOT", new PostConfigurationClosure());
Copy link
Contributor

Choose a reason for hiding this comment

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

2.3.0-SNAPSHOT definitely should be a constant

Copy link
Member Author

Choose a reason for hiding this comment

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

This is dummy test and will be removed.

* @throws IOException In case of an error.
* @see #readClosureFromFileAndDelete(String)
*/
public static void storeToFile(@NotNull IgniteInClosure clos, @NotNull String fileName) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why doesn't IgniteInClosure have generic parameter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think this is required?
I think no because given instance will be serialized to a file, without any type information.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is storeToFile common method? Or it will be used only in compatibility module with specific closure types?

If first - we should use
public static void <T> storeToFile(@NotNull IgniteInClosure<T> clos, @NotNull String fileName) throws IOException {
If second:
public static void storeToFile(@NotNull IgniteInClosure<Ignite> clos, @NotNull String fileName) throws IOException {

Copy link
Member Author

@daradurvs daradurvs Sep 21, 2017

Choose a reason for hiding this comment

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

It will be used only in the compatibility module with specific closure types:
IgniteInClosure<IgniteConfiguration>
IgniteInClosure<Ignite>

public static final String SYNCHRONIZATION_LOG_MESSAGE_PREPARED = "Remote node has prepared, id: ";

/** Waiting seconds of the join of a node to topology. */
protected static final int NODE_JOIN_TIMEOUT = 30;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why timeout specified in seconds?
Can we rename constant to NODE_JOIN_TIMEOUT_SEC or set a timeout in milliseconds?

Copy link
Member Author

@daradurvs daradurvs Sep 21, 2017

Choose a reason for hiding this comment

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

Agree. Timeout will be specified in milliseconds.

* @see #deleteDefaultDBWorkDirectory()
*/
@SuppressWarnings("ConstantConditions")
protected boolean defaultDBWorkDirectoryIsEmpty() throws IgniteCheckedException {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think method name should be isDefaultDBWorkDirectoryEmpty

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, will be fixed.

* @return Started grid.
* @throws Exception If failed.
*/
protected IgniteEx startGrid(int idx, String ver, IgniteInClosure<IgniteConfiguration> cfgClos) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use some sort of enum for ver variable?

Copy link
Member Author

@daradurvs daradurvs Sep 21, 2017

Choose a reason for hiding this comment

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

I thought about it.
Not sure is it required or no.

@@ -0,0 +1 @@
org.apache.ignite.compatibility.testframework.plugins.TestCompatibilityPluginProvider
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this provider would be available for regular test run?
If yes, we definitely should exclude it from regular test classpath.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this plugin will be used only in tests in the compatibility-module and won't be used in any other module like ignite-core.

@daradurvs daradurvs force-pushed the ignite-5732-module branch 4 times, most recently from cdd1021 to c683808 Compare September 22, 2017 16:48
@daradurvs
Copy link
Member Author

Merged to the master branch by the commit

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.

None yet

3 participants