This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch ignite-10071
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/ignite-10071 by this push:
new 171b4ff IGNITE-10071 Fix for case then background upload of a build
and simultaneous bot restart may result in a queued build persisted but
actually build is finished
171b4ff is described below
commit 171b4fff698a7db5066f5b2277f0561a39cc1e9a
Author: Dmitriy Pavlov <[email protected]>
AuthorDate: Mon Dec 3 16:09:16 2018 +0300
IGNITE-10071 Fix for case then background upload of a build and
simultaneous bot restart may result in a queued build persisted but actually
build is finished
---
.../ignited/IgnitedTcInMemoryIntegrationTest.java | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git
a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
index 9f68884..923ba18 100644
---
a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
+++
b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/teamcity/ignited/IgnitedTcInMemoryIntegrationTest.java
@@ -33,6 +33,7 @@ import javax.xml.bind.JAXBException;
import com.google.inject.internal.SingletonScope;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.Ignition;
import org.apache.ignite.ci.ITeamcity;
import org.apache.ignite.ci.analysis.SuiteInBranch;
@@ -68,6 +69,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.jetbrains.annotations.NotNull;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
@@ -123,6 +125,25 @@ public class IgnitedTcInMemoryIntegrationTest {
ignite.close();
}
+ /**
+ * Clear relevant ignite caches to avoid tests invluence to each other.
+ */
+ @Before
+ public void clearIgniteCaches() {
+ clearCache(BuildRefDao.TEAMCITY_BUILD_CACHE_NAME);
+ clearCache(FatBuildDao.TEAMCITY_FAT_BUILD_CACHE_NAME);
+ }
+
+ /**
+ * @param cacheName Cache name to clear.
+ */
+ private void clearCache(String cacheName) {
+ IgniteCache<Long, BuildRefCompacted> buildRefCache =
ignite.cache(cacheName);
+
+ if (buildRefCache != null)
+ buildRefCache.clear();
+ }
+
@Test
public void saveAndLoadBuildReference() throws IOException {
ITeamcityHttpConnection http =
Mockito.mock(ITeamcityHttpConnection.class);
@@ -551,6 +572,7 @@ public class IgnitedTcInMemoryIntegrationTest {
}
});
Injector injector = Guice.createInjector(module, new
IgniteAndShedulerTestModule());
+
IStringCompactor c = injector.getInstance(IStringCompactor.class);
BuildRefDao buildRefDao =
injector.getInstance(BuildRefDao.class).init();
FatBuildDao fatBuildDao =
injector.getInstance(FatBuildDao.class).init();