mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
filer: reuse fake master in chunk copy regression
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
This commit is contained in:
1 file changed
+2
-15
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
@@ -95,22 +94,10 @@ func TestCopyChunkManifestPreservesOverwrites(t *testing.T) {
|
||||
}
|
||||
}))
|
||||
t.Cleanup(volume.Close)
|
||||
master := &chunkCopyMaster{volumeURL: strings.TrimPrefix(volume.URL, "http://")}
|
||||
lis, err := net.Listen("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
grpcServer := grpc.NewServer()
|
||||
master_pb.RegisterSeaweedServer(grpcServer, master)
|
||||
go grpcServer.Serve(lis)
|
||||
t.Cleanup(grpcServer.Stop)
|
||||
_, port, err := net.SplitHostPort(lis.Addr().String())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
masterAddr := startFakeMasterServerForLeaderLookup(t, &chunkCopyMaster{volumeURL: strings.TrimPrefix(volume.URL, "http://")})
|
||||
dialOption := grpc.WithTransportCredentials(insecure.NewCredentials())
|
||||
mc := wdclient.NewMasterClient(dialOption, "", cluster.FilerType, "", "", "",
|
||||
*pb.NewServiceDiscoveryFromMap(map[string]pb.ServerAddress{"m": pb.ServerAddress("127.0.0.1:0." + port)}))
|
||||
*pb.NewServiceDiscoveryFromMap(map[string]pb.ServerAddress{"m": masterAddr}))
|
||||
go mc.KeepConnectedToMaster(ctx)
|
||||
mc.WaitUntilConnected(ctx)
|
||||
if ctx.Err() != nil {
|
||||
|
||||
Reference in new issue
Block a user