mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
Full internal rename — build-verified, every module green (root + s3-rdma-sidecar
+ telemetry/server + all test modules):
- Dirs: weed/→s3/ (main tree); cmd/weed-{db,sql}→cmd/s3-{db,sql};
seaweed-volume→s3-volume; seaweedfs-rdma-sidecar→s3-rdma-sidecar;
s3/mount/weedfs_*.go→s3fs_*.go (~113 path renames).
- Imports: github.com/hanzoai/s3/weed/ → /s3/ across 1700+ files.
- gRPC proto services Seaweed/SeaweedFiler/SeaweedMessaging/... → Hanzo*
(8 services) via full protoc regeneration (correct descriptors, no sed-corruption).
- Brand SeaweedFS/Seaweed/seaweed → Hanzo/hanzo; internal X-Seaweedfs-* headers
→ X-Hanzo-*; .seaweedfs config dir → .s3.
- CLI is `s3`: go install github.com/hanzoai/s3/s3@latest | make install | Docker.
install.sh rewritten as a Hanzo S3 installer.
- External forks github.com/seaweedfs/{raft,go-fuse,goexif,cockroachdb-parser}
kept verbatim — immutable third-party module paths; NOTICE retained.
Residual (cosmetic, non-build): kafka loadtest test-proto package com.seaweedfs.loadtest.
93 lines
2.2 KiB
Go
93 lines
2.2 KiB
Go
package framework
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"strconv"
|
|
"testing"
|
|
|
|
"github.com/hanzoai/s3/test/testutil"
|
|
"github.com/hanzoai/s3/test/volume_server/matrix"
|
|
)
|
|
|
|
type ClusterWithFiler struct {
|
|
*Cluster
|
|
|
|
filerCmd *exec.Cmd
|
|
filerPort int
|
|
filerGrpcPort int
|
|
}
|
|
|
|
func StartSingleVolumeClusterWithFiler(t testing.TB, profile matrix.Profile) *ClusterWithFiler {
|
|
t.Helper()
|
|
|
|
baseCluster := StartSingleVolumeCluster(t, profile)
|
|
|
|
ports, err := testutil.AllocatePorts(2)
|
|
if err != nil {
|
|
t.Fatalf("allocate filer ports: %v", err)
|
|
}
|
|
|
|
filerDataDir := filepath.Join(baseCluster.baseDir, "filer")
|
|
if mkErr := os.MkdirAll(filerDataDir, 0o755); mkErr != nil {
|
|
t.Fatalf("create filer data dir: %v", mkErr)
|
|
}
|
|
|
|
logFile, err := os.Create(filepath.Join(baseCluster.logsDir, "filer.log"))
|
|
if err != nil {
|
|
t.Fatalf("create filer log file: %v", err)
|
|
}
|
|
|
|
filerPort := ports[0]
|
|
filerGrpcPort := ports[1]
|
|
args := []string{
|
|
"-config_dir=" + baseCluster.configDir,
|
|
"filer",
|
|
"-master=127.0.0.1:" + strconv.Itoa(baseCluster.masterPort),
|
|
"-ip=127.0.0.1",
|
|
"-port=" + strconv.Itoa(filerPort),
|
|
"-port.grpc=" + strconv.Itoa(filerGrpcPort),
|
|
"-defaultStoreDir=" + filerDataDir,
|
|
}
|
|
|
|
filerCmd := exec.Command(baseCluster.s3Binary, args...)
|
|
filerCmd.Dir = baseCluster.baseDir
|
|
filerCmd.Stdout = logFile
|
|
filerCmd.Stderr = logFile
|
|
if err = filerCmd.Start(); err != nil {
|
|
t.Fatalf("start filer: %v", err)
|
|
}
|
|
|
|
if err = baseCluster.waitForTCP(net.JoinHostPort("127.0.0.1", strconv.Itoa(filerGrpcPort))); err != nil {
|
|
filerLogTail := baseCluster.tailLog("filer.log")
|
|
stopProcess(filerCmd)
|
|
t.Fatalf("wait for filer grpc readiness: %v\nfiler log tail:\n%s", err, filerLogTail)
|
|
}
|
|
|
|
t.Cleanup(func() {
|
|
stopProcess(filerCmd)
|
|
})
|
|
|
|
return &ClusterWithFiler{
|
|
Cluster: baseCluster,
|
|
filerCmd: filerCmd,
|
|
filerPort: filerPort,
|
|
filerGrpcPort: filerGrpcPort,
|
|
}
|
|
}
|
|
|
|
func (c *ClusterWithFiler) FilerAddress() string {
|
|
return net.JoinHostPort("127.0.0.1", strconv.Itoa(c.filerPort))
|
|
}
|
|
|
|
func (c *ClusterWithFiler) FilerGRPCAddress() string {
|
|
return net.JoinHostPort("127.0.0.1", strconv.Itoa(c.filerGrpcPort))
|
|
}
|
|
|
|
func (c *ClusterWithFiler) FilerServerAddress() string {
|
|
return fmt.Sprintf("%s.%d", c.FilerAddress(), c.filerGrpcPort)
|
|
}
|