ribaraka commented on code in PR #1780:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1780#discussion_r1745660866


##########
main_test.go:
##########
@@ -0,0 +1,145 @@
+//go:build cassandra || integration
+// +build cassandra integration
+
+package gocql
+
+import (
+       "context"
+       "flag"
+       "fmt"
+       "log"
+       "os"
+       "strconv"
+       "testing"
+       "time"
+
+       "github.com/testcontainers/testcontainers-go"
+       "github.com/testcontainers/testcontainers-go/wait"
+)
+
+func TestMain(m *testing.M) {
+       ctx := context.Background()
+
+       flag.Parse()
+
+       cassandraVersion := flagCassVersion.String()[1:]
+
+       jvmOpts := "-Dcassandra.test.fail_writes_ks=test 
-Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
+       if *clusterSize == 1 {
+               // speeds up the creation of a single-node cluster.
+               jvmOpts += " -Dcassandra.initial_token=0 
-Dcassandra.skip_wait_for_gossip_to_settle=0"
+       }
+
+       env := map[string]string{
+               "JVM_OPTS":                  jvmOpts,
+               "CASSANDRA_SEEDS":           "cassandra1",
+               "CASSANDRA_DC":              "datacenter1",
+               "HEAP_NEWSIZE":              "100M",
+               "MAX_HEAP_SIZE":             "256M",
+               "CASSANDRA_RACK":            "rack1",
+               "CASSANDRA_ENDPOINT_SNITCH": "GossipingPropertyFileSnitch",
+               "CASS_VERSION":              cassandraVersion,
+       }
+
+       if *flagRunAuthTest {
+               env["AUTH_TEST"] = "true"
+       }
+
+       networkRequest := testcontainers.GenericNetworkRequest{
+               NetworkRequest: testcontainers.NetworkRequest{
+                       Name: "cassandra",
+               },
+       }
+       cassandraNetwork, err := testcontainers.GenericNetwork(ctx, 
networkRequest)
+       if err != nil {
+               log.Fatalf("Failed to create network: %s", err)
+       }
+       defer cassandraNetwork.Remove(ctx)
+
+       // Function to create a Cassandra container (node)
+       createCassandraContainer := func(number int) (string, error) {

Review Comment:
   The current version of gocql is 1.13, and the decision on which version to 
upgrade to hasn't been finalized yet. For now, I’m keeping things simple by not 
using the modules.
   
   Initially, I started with the cass module, but I didn't find it handy. 
Managing an additional import also felt unnecessary since the generic structs 
already provided most of the required functionality.
   
   Once the Go version is decided, I plan to revise the Cassandra model and see 
what I can do to enhance the functionality that I might have been missing and 
make it handy :smile: 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to