cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject cassandra git commit: Make CQLMetricsTest tests independent of each other
Date Fri, 02 Oct 2015 15:53:47 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 62ffa355e -> 30e14a30d


Make CQLMetricsTest tests independent of each other


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/30e14a30
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/30e14a30
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/30e14a30

Branch: refs/heads/cassandra-3.0
Commit: 30e14a30da24f326c4ccf91a66a7794271b6fc33
Parents: 62ffa35
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Fri Oct 2 17:53:40 2015 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Fri Oct 2 17:53:40 2015 +0200

----------------------------------------------------------------------
 .../unit/org/apache/cassandra/metrics/CQLMetricsTest.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/30e14a30/test/unit/org/apache/cassandra/metrics/CQLMetricsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/metrics/CQLMetricsTest.java b/test/unit/org/apache/cassandra/metrics/CQLMetricsTest.java
index 2864b6e..099a530 100644
--- a/test/unit/org/apache/cassandra/metrics/CQLMetricsTest.java
+++ b/test/unit/org/apache/cassandra/metrics/CQLMetricsTest.java
@@ -44,7 +44,6 @@ public class CQLMetricsTest extends SchemaLoader
 
     private static Cluster cluster;
     private static Session session;
-    private static PreparedStatement metricsStatement;
 
     @BeforeClass()
     public static void setup() throws ConfigurationException, IOException
@@ -64,15 +63,16 @@ public class CQLMetricsTest extends SchemaLoader
     @Test
     public void testPreparedStatementsCount()
     {
-        assertEquals(0, (int) QueryProcessor.metrics.preparedStatementsCount.getValue());
-        metricsStatement = session.prepare("INSERT INTO junit.metricstest (id, val) VALUES
(?, ?)");
-        assertEquals(1, (int) QueryProcessor.metrics.preparedStatementsCount.getValue());
+        int n = (int) QueryProcessor.metrics.preparedStatementsCount.getValue();
+        session.prepare("SELECT * FROM junit.metricstest WHERE id = ?");
+        assertEquals(n+1, (int) QueryProcessor.metrics.preparedStatementsCount.getValue());
     }
 
     @Test
     public void testRegularStatementsExecuted()
     {
         clearMetrics();
+        PreparedStatement metricsStatement = session.prepare("INSERT INTO junit.metricstest
(id, val) VALUES (?, ?)");
 
         assertEquals(0, QueryProcessor.metrics.preparedStatementsExecuted.getCount());
         assertEquals(0, QueryProcessor.metrics.regularStatementsExecuted.getCount());
@@ -88,6 +88,7 @@ public class CQLMetricsTest extends SchemaLoader
     public void testPreparedStatementsExecuted()
     {
         clearMetrics();
+        PreparedStatement metricsStatement = session.prepare("INSERT INTO junit.metricstest
(id, val) VALUES (?, ?)");
 
         assertEquals(0, QueryProcessor.metrics.preparedStatementsExecuted.getCount());
         assertEquals(0, QueryProcessor.metrics.regularStatementsExecuted.getCount());
@@ -103,6 +104,7 @@ public class CQLMetricsTest extends SchemaLoader
     public void testPreparedStatementsRatio()
     {
         clearMetrics();
+        PreparedStatement metricsStatement = session.prepare("INSERT INTO junit.metricstest
(id, val) VALUES (?, ?)");
 
         assertEquals(Double.NaN, QueryProcessor.metrics.preparedStatementsRatio.getValue());
 


Mime
View raw message