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.
175 lines
4.4 KiB
Go
175 lines
4.4 KiB
Go
package foundationdb
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestPackageStructure validates the FoundationDB package structure without requiring dependencies
|
|
func TestPackageStructure(t *testing.T) {
|
|
t.Log("✅ Testing FoundationDB package structure...")
|
|
|
|
// Verify the main package files exist
|
|
packagePath := "../../s3/filer/foundationdb"
|
|
expectedFiles := map[string]bool{
|
|
"foundationdb_store.go": false,
|
|
"foundationdb_store_test.go": false,
|
|
"doc.go": false,
|
|
"README.md": false,
|
|
}
|
|
|
|
err := filepath.Walk(packagePath, func(path string, info os.FileInfo, err error) error {
|
|
if err != nil {
|
|
return nil // Skip errors
|
|
}
|
|
fileName := filepath.Base(path)
|
|
if _, exists := expectedFiles[fileName]; exists {
|
|
expectedFiles[fileName] = true
|
|
t.Logf("Found: %s", fileName)
|
|
}
|
|
return nil
|
|
})
|
|
|
|
if err != nil {
|
|
t.Logf("Warning: Could not access package path %s", packagePath)
|
|
}
|
|
|
|
for file, found := range expectedFiles {
|
|
if found {
|
|
t.Logf("✅ %s exists", file)
|
|
} else {
|
|
t.Logf("⚠️ %s not found (may be normal)", file)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestServerIntegration validates that the filer server includes FoundationDB import
|
|
func TestServerIntegration(t *testing.T) {
|
|
t.Log("✅ Testing server integration...")
|
|
|
|
serverFile := "../../s3/server/filer_server.go"
|
|
content, err := os.ReadFile(serverFile)
|
|
if err != nil {
|
|
t.Skipf("Cannot read server file: %v", err)
|
|
return
|
|
}
|
|
|
|
contentStr := string(content)
|
|
|
|
// Check for FoundationDB import
|
|
if strings.Contains(contentStr, `"github.com/hanzoai/s3/s3/filer/foundationdb"`) {
|
|
t.Log("✅ FoundationDB import found in filer_server.go")
|
|
} else {
|
|
t.Error("❌ FoundationDB import not found in filer_server.go")
|
|
}
|
|
|
|
// Check for other expected imports for comparison
|
|
expectedImports := []string{
|
|
"leveldb",
|
|
"redis",
|
|
"mysql",
|
|
}
|
|
|
|
foundImports := 0
|
|
for _, imp := range expectedImports {
|
|
if strings.Contains(contentStr, fmt.Sprintf(`"github.com/hanzoai/s3/s3/filer/%s"`, imp)) {
|
|
foundImports++
|
|
}
|
|
}
|
|
|
|
t.Logf("✅ Found %d/%d expected filer store imports", foundImports, len(expectedImports))
|
|
}
|
|
|
|
// TestBuildConstraints validates that build constraints work correctly
|
|
func TestBuildConstraints(t *testing.T) {
|
|
t.Log("✅ Testing build constraints...")
|
|
|
|
// Check that foundationdb package files have correct build tags
|
|
packagePath := "../../s3/filer/foundationdb"
|
|
|
|
err := filepath.Walk(packagePath, func(path string, info os.FileInfo, err error) error {
|
|
if err != nil || !strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "_test.go") {
|
|
return nil
|
|
}
|
|
|
|
content, readErr := os.ReadFile(path)
|
|
if readErr != nil {
|
|
return nil
|
|
}
|
|
|
|
contentStr := string(content)
|
|
|
|
// Skip doc.go as it might not have build tags
|
|
if strings.HasSuffix(path, "doc.go") {
|
|
return nil
|
|
}
|
|
|
|
if strings.Contains(contentStr, "//go:build foundationdb") ||
|
|
strings.Contains(contentStr, "// +build foundationdb") {
|
|
t.Logf("✅ Build constraints found in %s", filepath.Base(path))
|
|
} else {
|
|
t.Logf("⚠️ No build constraints in %s", filepath.Base(path))
|
|
}
|
|
|
|
return nil
|
|
})
|
|
|
|
if err != nil {
|
|
t.Logf("Warning: Could not validate build constraints: %v", err)
|
|
}
|
|
}
|
|
|
|
// TestDocumentationExists validates that documentation files are present
|
|
func TestDocumentationExists(t *testing.T) {
|
|
t.Log("✅ Testing documentation...")
|
|
|
|
docs := []struct {
|
|
path string
|
|
name string
|
|
}{
|
|
{"README.md", "Main README"},
|
|
{"Makefile", "Build automation"},
|
|
{"docker-compose.yml", "Docker setup"},
|
|
{"filer.toml", "Configuration template"},
|
|
{"../../s3/filer/foundationdb/README.md", "Package README"},
|
|
}
|
|
|
|
for _, doc := range docs {
|
|
if _, err := os.Stat(doc.path); err == nil {
|
|
t.Logf("✅ %s exists", doc.name)
|
|
} else {
|
|
t.Logf("⚠️ %s not found: %s", doc.name, doc.path)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestConfigurationValidation tests configuration file syntax
|
|
func TestConfigurationValidation(t *testing.T) {
|
|
t.Log("✅ Testing configuration files...")
|
|
|
|
// Test filer.toml syntax
|
|
if content, err := os.ReadFile("filer.toml"); err == nil {
|
|
contentStr := string(content)
|
|
|
|
expectedConfigs := []string{
|
|
"[foundationdb]",
|
|
"enabled",
|
|
"cluster_file",
|
|
"api_version",
|
|
}
|
|
|
|
for _, config := range expectedConfigs {
|
|
if strings.Contains(contentStr, config) {
|
|
t.Logf("✅ Found config: %s", config)
|
|
} else {
|
|
t.Logf("⚠️ Config not found: %s", config)
|
|
}
|
|
}
|
|
} else {
|
|
t.Log("⚠️ filer.toml not accessible")
|
|
}
|
|
}
|