From a8b73296d7ea4c5103a1e3d7b889826983ad6565 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 16 Mar 2024 23:53:46 -0700 Subject: [PATCH] fix test3 --- weed/mq/broker/broker_test.go | 47 ----------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 weed/mq/broker/broker_test.go diff --git a/weed/mq/broker/broker_test.go b/weed/mq/broker/broker_test.go deleted file mode 100644 index 3d0b0a19c..000000000 --- a/weed/mq/broker/broker_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package broker - -import ( - "context" - "fmt" - "net" - "testing" - "time" - - "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb" - "google.golang.org/grpc" - "google.golang.org/grpc/test/bufconn" -) - -var lis *bufconn.Listener - -func init() { - lis = bufconn.Listen(1024 * 1024) - server := grpc.NewServer() - mq_pb.RegisterSeaweedMessagingServer(server, &MessageQueueBroker{}) - go func() { - if err := server.Serve(lis); err != nil { - fmt.Printf("Server exited with error: %v", err) - } - }() -} - -func bufDialer(string, time.Duration) (net.Conn, error) { - return lis.Dial() -} - -func TestMessageQueueBroker_ListTopics(t *testing.T) { - conn, err := grpc.DialContext(context.Background(), "bufnet", grpc.WithDialer(bufDialer), grpc.WithInsecure()) - if err != nil { - t.Fatalf("Failed to dial bufnet: %v", err) - } - defer conn.Close() - - client := mq_pb.NewSeaweedMessagingClient(conn) - request := &mq_pb.ListTopicsRequest{} - - _, err = client.ListTopics(context.Background(), request) - if err == nil { - t.Fatalf("Add failed: %v", err) - } - -}