Skip to content

Commit fe263ae

Browse files
sanpwcsk0x50
authored andcommitted
IGNITE-13868 Added additional tests related to simultaneously created caches. Fixes #8584
Signed-off-by: Slava Koptilin <slava.koptilin@gmail.com>
1 parent 873bb4f commit fe263ae

File tree

3 files changed

+1319
-1
lines changed

3 files changed

+1319
-1
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.ignite.common;
19+
20+
import java.util.UUID;
21+
import java.util.concurrent.atomic.AtomicBoolean;
22+
import org.apache.ignite.internal.IgniteInternalFuture;
23+
import org.apache.ignite.testframework.GridTestUtils;
24+
25+
/**
26+
* {@inheritDoc} With topology events in parallel
27+
*/
28+
public class ClientSideCacheCreationDestructionWileTopologyChangeTest extends ClientSizeCacheCreationDestructionTest {
29+
/** **/
30+
private static final int MAX_NODES_CNT = 10;
31+
32+
/** **/
33+
IgniteInternalFuture topChangeProcFut;
34+
35+
/** **/
36+
AtomicBoolean procTopChanges = new AtomicBoolean(true);
37+
38+
/** {@inheritDoc} */
39+
@Override protected void beforeTest() throws Exception {
40+
super.beforeTest();
41+
42+
topChangeProcFut = asyncTopologyChanges();
43+
}
44+
45+
/** {@inheritDoc} */
46+
@Override protected void afterTest() throws Exception {
47+
procTopChanges.set(false);
48+
49+
topChangeProcFut.get();
50+
51+
super.afterTest();
52+
}
53+
54+
/**
55+
* @return {@code IgniteInternalFuture} to wait for topology process to stop in {@code afterTest()}.
56+
*/
57+
private IgniteInternalFuture asyncTopologyChanges() {
58+
return GridTestUtils.runAsync(() -> {
59+
while (procTopChanges.get()) {
60+
try {
61+
if (srv.cluster().nodes().size() < MAX_NODES_CNT)
62+
startGrid(UUID.randomUUID().toString());
63+
}
64+
catch (Exception e) {
65+
fail("Unable to add or remove node: " + e);
66+
}
67+
}
68+
});
69+
}
70+
}

0 commit comments

Comments
 (0)