cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject [cassandra] 01/01: Merge branch 'cassandra-3.11' into cassandra-4.0
Date Thu, 02 Sep 2021 09:12:50 GMT
This is an automated email from the ASF dual-hosted git repository.

bereng pushed a commit to branch cassandra-4.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 6a4a93a808cd3c671f42bc41d0d8672e566cc5a3
Merge: b5e1386 957c626
Author: Bereng <berenguerblasi@gmail.com>
AuthorDate: Thu Sep 2 11:07:24 2021 +0200

    Merge branch 'cassandra-3.11' into cassandra-4.0

 .../apache/cassandra/cache/NopCacheProvider.java   |  5 +++
 .../cassandra/distributed/test/NodeToolTest.java   | 11 +++++
 .../cassandra/cache/NopCacheProviderTest.java      | 47 ++++++++++++++++++++++
 3 files changed, 63 insertions(+)

diff --cc test/distributed/org/apache/cassandra/distributed/test/NodeToolTest.java
index 7c76080,aaa7dc3..89e6168
--- a/test/distributed/org/apache/cassandra/distributed/test/NodeToolTest.java
+++ b/test/distributed/org/apache/cassandra/distributed/test/NodeToolTest.java
@@@ -18,16 -18,10 +18,17 @@@
  
  package org.apache.cassandra.distributed.test;
  
 +import java.io.IOException;
 +import java.util.function.Consumer;
 +
 +import org.junit.AfterClass;
 +import org.junit.BeforeClass;
  import org.junit.Test;
  
 +import org.apache.cassandra.config.DatabaseDescriptor;
  import org.apache.cassandra.distributed.Cluster;
+ import org.apache.cassandra.distributed.api.ICluster;
 +import org.apache.cassandra.distributed.api.IInvokableInstance;
  import org.apache.cassandra.distributed.api.NodeToolResult;
  
  import static org.junit.Assert.assertEquals;
@@@ -79,30 -40,24 +80,40 @@@ public class NodeToolTest extends TestB
      }
  
      @Test
 -    public void testCaptureConsoleOutput() throws Throwable
 +    public void testSetGetTimeout()
      {
 -        try (ICluster cluster = init(builder().withNodes(1).start()))
 +        Consumer<String> test = timeout ->
          {
 -            NodeToolResult ringResult = cluster.get(1).nodetoolResult("ring");
 -            ringResult.asserts().stdoutContains("Datacenter: datacenter0");
 -            ringResult.asserts().stdoutContains("127.0.0.1  rack0       Up     Normal");
 -            assertEquals("Non-empty error output", "", ringResult.getStderr());
 -        }
 +            if (timeout != null)
 +                NODE.nodetool("settimeout", "internodestreaminguser", timeout);
 +            timeout = NODE.callOnInstance(() -> String.valueOf(DatabaseDescriptor.getInternodeStreamingTcpUserTimeoutInMS()));
 +            NODE.nodetoolResult("gettimeout", "internodestreaminguser")
 +                .asserts()
 +                .success()
 +                .stdoutContains("Current timeout for type internodestreaminguser: " + timeout
+ " ms");
 +        };
 +
 +        test.accept(null); // test the default value
 +        test.accept("1000"); // 1 second
 +        test.accept("36000000"); // 10 minutes
 +    }
 +
 +    @Test
 +    public void testSetTimeoutInvalidInput()
 +    {
 +        NODE.nodetoolResult("settimeout", "internodestreaminguser", "-1")
 +            .asserts()
 +            .failure()
 +            .stdoutContains("timeout must be non-negative");
      }
+ 
+     @Test
+     public void testSetCacheCapacityWhenDisabled() throws Throwable
+     {
+         try (ICluster cluster = init(builder().withNodes(1).withConfig(c->c.set("row_cache_size_in_mb",
"0")).start()))
+         {
+             NodeToolResult ringResult = cluster.get(1).nodetoolResult("setcachecapacity",
"1", "1", "1");
+             ringResult.asserts().stderrContains("is not permitted as this cache is disabled");
+         }
+     }
  }
diff --cc test/unit/org/apache/cassandra/cache/NopCacheProviderTest.java
index 0000000,8807883..59f6181
mode 000000,100644..100644
--- a/test/unit/org/apache/cassandra/cache/NopCacheProviderTest.java
+++ b/test/unit/org/apache/cassandra/cache/NopCacheProviderTest.java
@@@ -1,0 -1,46 +1,47 @@@
+ /*
+  * Licensed to the Apache Software Foundation (ASF) under one
+  * or more contributor license agreements.  See the NOTICE file
+  * distributed with this work for additional information
+  * regarding copyright ownership.  The ASF licenses this file
+  * to you under the Apache License, Version 2.0 (the
+  * "License"); you may not use this file except in compliance
+  * with the License.  You may obtain a copy of the License at
+  *
 - *     http://www.apache.org/licenses/LICENSE-2.0
++ *   http://www.apache.org/licenses/LICENSE-2.0
+  *
 - * Unless required by applicable law or agreed to in writing, software
 - * distributed under the License is distributed on an "AS IS" BASIS,
 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 - * See the License for the specific language governing permissions and
 - * limitations under the License.
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied.  See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
+  */
+ 
+ package org.apache.cassandra.cache;
+ 
+ import org.junit.Before;
+ import org.junit.Test;
+ 
+ public class NopCacheProviderTest
+ {
+     private ICache<RowCacheKey, IRowCacheEntry> cache;
+ 
+     @Before
+     public void createCache()
+     {
+         NopCacheProvider cacheProvider = new NopCacheProvider();
+         cache = cacheProvider.create();
+     }
+ 
+     @Test
+     public void settingCapacityToZeroIsIgnored()
+     {
+         cache.setCapacity(0L);
+     }
+ 
+     @Test(expected = UnsupportedOperationException.class)
+     public void failsOnSettingCapacityOtherThanZero()
+     {
+         cache.setCapacity(1);
+     }
+ }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message