in continuous_load_testing/client.go [266:335]
func main() {
log.Println("DirectPath Continuous Load Testing Client Started - test15.")
log.Printf("Concurrency level: %d", *concurrency)
flag.Parse()
var serverAddr string
if *disableDirectPath {
serverAddr = cloudPathServerAddr
} else {
serverAddr = directPathServerAddr
}
log.Printf("serverAddr: %s", serverAddr)
if *methodsInput != "" {
log.Printf("Methods input received: %s", *methodsInput)
methodList := strings.Split(*methodsInput, ",")
for _, method := range methodList {
method = strings.TrimSpace(method)
if _, exists := methods[method]; !exists {
log.Fatalf("Invalid method specified: %s. Available methods are: EmptyCall, UnaryCall, StreamingInputCall, StreamingOutputCall, FullDuplexCall, HalfDuplexCall", method)
}
methods[method] = true
log.Printf("Enabled method: %s", method)
}
} else {
methods["EmptyCall"] = true
log.Println("No methods input received.default EmptyCall")
}
log.Println("Setting up OpenTelemetry...")
opts, err := setupOpenTelemetry()
if err != nil {
log.Fatalf("Failed to set up OpenTelemetry: %v", err)
}
log.Println("OpenTelemetry setup completed.")
opts = append(opts, grpc.WithCredentialsBundle(google.NewDefaultCredentials()))
log.Println("Attempting to create gRPC connection...")
conn, err := grpc.NewClient(serverAddr, opts...)
if err != nil {
log.Fatalf("Failed to connect to gRPC server %v", err)
}
log.Println("Successfully connected to gRPC server")
defer conn.Close()
stub := test.NewTestServiceClient(conn)
log.Println("gRPC client stub created.")
if methods["EmptyCall"] {
go executeMethod("EmptyCall", ExecuteEmptyCalls, stub)
log.Println("EmptyCall method started in background")
}
if methods["UnaryCall"] {
go executeMethod("UnaryCall", ExecuteUnaryCalls, stub)
log.Println("UnaryCall method started in background")
}
if methods["StreamingInputCall"] {
go executeMethod("StreamingInputCall", ExecuteStreamingInputCalls, stub)
log.Println("StreamingInputCall method started in background")
}
if methods["StreamingOutputCall"] {
go executeMethod("StreamingOutputCall", ExecuteStreamingOutputCalls, stub)
log.Println("StreamingOutputCall method started in background")
}
if methods["FullDuplexCall"] {
go executeMethod("FullDuplexCall", ExecuteFullDuplexCalls, stub)
log.Println("FullDuplexCall method started in background")
}
if methods["HalfDuplexCall"] {
go executeMethod("HalfDuplexCall", ExecuteHalfDuplexCalls, stub)
log.Println("HalfDuplexCall method started in background")
}
forever := make(chan struct{})
<-forever
log.Println("All test cases completed.")
}