You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/02/07 20:48:45 UTC

[GitHub] [cassandra] aratno commented on a change in pull request #1382: CASSANDRA-16262: Intoduce Harry to the tree

aratno commented on a change in pull request #1382:
URL: https://github.com/apache/cassandra/pull/1382#discussion_r801045491



##########
File path: test/distributed/org/apache/cassandra/distributed/fuzz/test/SSTableGeneratorTest.java
##########
@@ -0,0 +1,134 @@
+/*
+ * 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
+ *
+ * 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.distributed.fuzz.test;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+
+import com.google.common.collect.Iterators;
+import org.junit.Test;
+
+import harry.core.Configuration;
+import harry.core.Run;
+import harry.ddl.ColumnSpec;
+import harry.ddl.SchemaSpec;
+import harry.model.Model;
+import harry.model.QuiescentChecker;
+import harry.model.clock.OffsetClock;
+import harry.model.sut.SystemUnderTest;
+import harry.operations.Query;
+import harry.visitors.GeneratingVisitor;
+import harry.visitors.LtsVisitor;
+import org.apache.cassandra.cql3.CQLTester;
+import org.apache.cassandra.distributed.fuzz.HarryRunner;
+import org.apache.cassandra.distributed.fuzz.SSTableLoadingVisitor;
+import org.apache.cassandra.distributed.impl.RowUtil;
+
+public class SSTableGeneratorTest extends CQLTester
+{
+    private static Configuration configuration;
+
+    static
+    {
+        try
+        {
+            HarryRunner.init();
+            configuration = HarryRunner.configuration("test/conf/harry-generic.yaml")
+                                       .unbuild()
+                                       .setClock(() -> new OffsetClock(10000L))
+                                       .build();
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static SchemaSpec schemaSpec = new SchemaSpec(KEYSPACE, "tbl1",
+                                                          Arrays.asList(ColumnSpec.pk("pk1", ColumnSpec.asciiType),
+                                                                        ColumnSpec.pk("pk2", ColumnSpec.int64Type)),
+                                                          Arrays.asList(ColumnSpec.ck("ck1", ColumnSpec.asciiType, false),
+                                                                        ColumnSpec.ck("ck2", ColumnSpec.int64Type, false)),
+                                                          Arrays.asList(ColumnSpec.regularColumn("v1", ColumnSpec.int32Type),
+                                                                        ColumnSpec.regularColumn("v2", ColumnSpec.int64Type),
+                                                                        ColumnSpec.regularColumn("v3", ColumnSpec.int32Type),
+                                                                        ColumnSpec.regularColumn("v4", ColumnSpec.asciiType)),
+                                                          Arrays.asList(ColumnSpec.staticColumn("s1", ColumnSpec.asciiType),
+                                                                        ColumnSpec.staticColumn("s2", ColumnSpec.int64Type)));
+
+    @Test
+    public void testSSTableGenerator()
+    {
+        createTable(schemaSpec.compile().cql());
+        Run run = configuration.unbuild()
+                               .setSeed(1)
+                               .setSchemaProvider(new HarryRunner.FixedSchemaProviderConfiguration(schemaSpec))
+                               .setSUT(CqlTesterSUT::new)
+                               .build()
+                               .createRun();
+
+
+        SSTableLoadingVisitor sstableVisitor = new SSTableLoadingVisitor(run, 1000);
+        LtsVisitor visitor = new GeneratingVisitor(run, sstableVisitor);
+        Set<Long> pds = new HashSet<>();
+        run.tracker.onLtsStarted((lts) -> {
+            pds.add(run.pdSelector.pd(lts, run.schemaSpec));
+        });
+        for (int i = 0; i < 1000; i++)
+            visitor.visit();
+
+        sstableVisitor.forceFlush(0);
+
+        Model checker = new QuiescentChecker(run);
+        for (Long pd : pds)
+            checker.validate(Query.selectPartition(run.schemaSpec, pd, false));

Review comment:
       Yep -- where do you want Harry tickets? In the C* JIRA?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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