diff --git a/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java b/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java index 13f4194f30f9e..e26b9d78401eb 100644 --- a/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java +++ b/enterprise/kernel/src/test/java/org/neo4j/kernel/enterprise/builtinprocs/ListQueriesProcedureTest.java @@ -80,6 +80,7 @@ protected void configure( GraphDatabaseBuilder builder ) }; @Rule public final ThreadingRule threads = new ThreadingRule(); + private static final int THIRTY_SECONDS_TIMEOUT = 30; @Test public void shouldContainTheQueryItself() throws Exception @@ -109,7 +110,7 @@ public void shouldNotIncludeDeprecatedFields() throws Exception } @Test - public void shouldProvideElapsedCpuTime() throws Exception + public void shouldProvideElapsedCpuTimePlannerConnectionDetailsPageHitsAndFaults() throws Exception { // given String query = "MATCH (n) SET n.v = n.v + 1"; @@ -146,6 +147,26 @@ public void shouldProvideElapsedCpuTime() throws Exception assertThat( cpuTime2, greaterThanOrEqualTo( (Long) cpuTime1 ) ); Long waitTime2 = (Long) data.get( "waitTimeMillis" ); assertThat( waitTime2, greaterThanOrEqualTo( (Long) waitTime1 ) ); + + // ListPlannerAndRuntimeUsed + // then + assertThat( data, hasKey( "planner" ) ); + assertThat( data, hasKey( "runtime" ) ); + assertThat( data.get( "planner" ), instanceOf( String.class ) ); + assertThat( data.get( "runtime" ), instanceOf( String.class ) ); + + // SpecificConnectionDetails + + // then + assertThat( data, hasKey( "protocol" ) ); + assertThat( data, hasKey( "clientAddress" ) ); + assertThat( data, hasKey( "requestUri" ) ); + + //ContainPageHitsAndPageFaults + // then + assertThat( data, hasEntry( equalTo( "pageHits" ), instanceOf( Long.class ) ) ); + assertThat( data, hasEntry( equalTo( "pageFaults" ), instanceOf( Long.class ) ) ); + } } @@ -184,24 +205,6 @@ public void shouldProvideAllocatedBytes() throws Exception } } - @Test - public void shouldListPlannerAndRuntimeUsed() throws Exception - { - // given - String QUERY = "MATCH (n) SET n.v = n.v - 1"; - try ( Resource test = test( db::createNode, Transaction::acquireWriteLock, QUERY ) ) - { - // when - Map data = getQueryListing( QUERY ); - - // then - assertThat( data, hasKey( "planner" ) ); - assertThat( data, hasKey( "runtime" ) ); - assertThat( data.get( "planner" ), instanceOf( String.class ) ); - assertThat( data.get( "runtime" ), instanceOf( String.class ) ); - } - } - @Test public void shouldListActiveLocks() throws Exception { @@ -262,34 +265,6 @@ public void shouldListActiveLocks() throws Exception } } - @Test - public void shouldContainSpecificConnectionDetails() throws Exception - { - // when - Map data = getQueryListing( "CALL dbms.listQueries" ); - - // then - assertThat( data, hasKey( "protocol" ) ); - assertThat( data, hasKey( "clientAddress" ) ); - assertThat( data, hasKey( "requestUri" ) ); - } - - @Test - public void shouldContainPageHitsAndPageFaults() throws Exception - { - // given - String query = "MATCH (n) SET n.v = n.v + 1"; - try ( Resource test = test( db::createNode, Transaction::acquireWriteLock, query ) ) - { - // when - Map data = getQueryListing( query ); - - // then - assertThat( data, hasEntry( equalTo( "pageHits" ), instanceOf( Long.class ) ) ); - assertThat( data, hasEntry( equalTo( "pageFaults" ), instanceOf( Long.class ) ) ); - } - } - @Test public void shouldListUsedIndexes() throws Exception { @@ -497,7 +472,7 @@ private Resource test( Supplier setup, BiConsumer lock, { db.execute( query ).close(); return null; - }, null, waitingWhileIn( GraphDatabaseFacade.class, "execute" ), 5, SECONDS ); + }, null, waitingWhileIn( GraphDatabaseFacade.class, "execute" ), THIRTY_SECONDS_TIMEOUT, SECONDS ); return new Resource( listQueriesLatch, resource ); } diff --git a/integrationtests/src/test/java/org/neo4j/causalclustering/scenarios/ListQueriesProcedureInClusterIT.java b/integrationtests/src/test/java/org/neo4j/causalclustering/scenarios/ListQueriesProcedureInClusterIT.java index df277ed0c0174..f7a6f5094dedc 100644 --- a/integrationtests/src/test/java/org/neo4j/causalclustering/scenarios/ListQueriesProcedureInClusterIT.java +++ b/integrationtests/src/test/java/org/neo4j/causalclustering/scenarios/ListQueriesProcedureInClusterIT.java @@ -50,6 +50,7 @@ public class ListQueriesProcedureInClusterIT { + private static final int THIRTY_SECONDS_TIMEOUT = 30; private final ClusterRule clusterRule = new ClusterRule( getClass() ).withNumberOfCoreMembers( 3 ).withNumberOfReadReplicas( 1 ); private final VerboseTimeout timeout = VerboseTimeout.builder().withTimeout( 1000, SECONDS ).build(); @@ -97,7 +98,7 @@ public void listQueriesWillNotIncludeQueriesFromOtherServersInCluster() throws E //When threads.executeAndAwait( executeQuery( CORE_QUERY, executedCoreQueryLatch::countDown ),/*on: */ leaderDb, - waitingWhileIn( GraphDatabaseFacade.class, "execute" ), 5, SECONDS ); + waitingWhileIn( GraphDatabaseFacade.class, "execute" ), THIRTY_SECONDS_TIMEOUT, SECONDS ); //Then Optional> coreQueryListing1 = getQueryListing( CORE_QUERY, leaderDb );