filer: reuse fake master in chunk copy regression

Signed-off-by: Perfloop Agent <agent@perfloop.ai>
This commit is contained in:
Perfloop Agent committed 2026-12-04 05:35:33 +00:00
1 parent 165b870baa
commit c00b846bf5
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 {