Skip to content

Commit

Permalink
Test failure: org.apache.cassandra.distributed.test.ByteBuddyExamples…
Browse files Browse the repository at this point in the history
…Test.countTest
  • Loading branch information
bereng committed Jul 14, 2023
1 parent 17afd5e commit 2af60dc
Showing 1 changed file with 10 additions and 3 deletions.
Expand Up @@ -21,20 +21,23 @@
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

import org.junit.Test;

import net.bytebuddy.ByteBuddy;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.SuperCall;
import org.apache.cassandra.cql3.ColumnSpecification;
import org.apache.cassandra.cql3.QueryOptions;
import org.apache.cassandra.cql3.statements.ModificationStatement;
import org.apache.cassandra.cql3.statements.SelectStatement;
import org.apache.cassandra.distributed.Cluster;
import org.apache.cassandra.distributed.api.ConsistencyLevel;
import org.apache.cassandra.service.QueryState;
import org.apache.cassandra.transport.messages.ResultMessage;
import org.apache.cassandra.transport.messages.ResultMessage.Rows;

import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
Expand Down Expand Up @@ -86,7 +89,7 @@ public void countTest() throws IOException
.withInstanceInitializer(BBCountHelper::install)
.start()))
{
cluster.schemaChange("create table " + KEYSPACE + ".tbl (id int primary key, t int)");
cluster.schemaChange("create table " + KEYSPACE + ".tbl (id int primary key, bytebuddy_test_column int)");
cluster.coordinator(1).execute("select * from " + KEYSPACE + ".tbl;", ConsistencyLevel.ALL);
cluster.coordinator(2).execute("select * from " + KEYSPACE + ".tbl;", ConsistencyLevel.ALL);
cluster.get(1).runOnInstance(() -> {
Expand Down Expand Up @@ -115,8 +118,12 @@ static void install(ClassLoader cl, int nodeNumber)

public static ResultMessage.Rows execute(QueryState state, QueryOptions options, long queryStartNanoTime, @SuperCall Callable<ResultMessage.Rows> r) throws Exception
{
count.incrementAndGet();
return r.call();
Rows res = r.call();

if (res.result.metadata.names.stream().map(ColumnSpecification::toString).collect(Collectors.toList()).contains("bytebuddy_test_column"))
count.incrementAndGet();

return res;
}
}

Expand Down

0 comments on commit 2af60dc

Please sign in to comment.