From 55eb7e2cb847c83494a3888208dddbc31d913697 Mon Sep 17 00:00:00 2001 From: Madhava Jay Date: Fri, 28 Nov 2025 11:55:19 +1000 Subject: [PATCH] fix nested paths --- cmd/devstack/devstack_integration_test.go | 2 +- cmd/devstack/main.go | 14 +++++++---- cmd/devstack/performance_test_harness.go | 30 +++++++++++------------ justfile | 4 +-- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/cmd/devstack/devstack_integration_test.go b/cmd/devstack/devstack_integration_test.go index 29e543c0..2847f680 100644 --- a/cmd/devstack/devstack_integration_test.go +++ b/cmd/devstack/devstack_integration_test.go @@ -188,7 +188,7 @@ func TestDevstackIntegration(t *testing.T) { src := emails[0] for _, email := range emails[1:] { // Check that bob has alice's public files - targetDir := filepath.Join(opts.root, email, "datasites", "datasites", src, "public") + targetDir := filepath.Join(opts.root, email, "datasites", src, "public") entries, err := os.ReadDir(targetDir) if err != nil { t.Fatalf("read target dir %s: %v", targetDir, err) diff --git a/cmd/devstack/main.go b/cmd/devstack/main.go index 85bfaa33..053ed5f0 100644 --- a/cmd/devstack/main.go +++ b/cmd/devstack/main.go @@ -728,8 +728,12 @@ func startClient(binPath, root, email, serverURL string, port int) (clientState, if err := os.MkdirAll(configDir, 0o755); err != nil { return clientState{}, err } - dataDir := filepath.Join(emailDir, "datasites") - if err := os.MkdirAll(dataDir, 0o755); err != nil { + dataDir := emailDir + // Ensure encrypted and shadow roots exist under the workspace root. + if err := os.MkdirAll(filepath.Join(dataDir, "datasites"), 0o755); err != nil { + return clientState{}, err + } + if err := os.MkdirAll(filepath.Join(dataDir, "unencrypted"), 0o755); err != nil { return clientState{}, err } logDir := filepath.Join(homeDir, ".syftbox", "logs") @@ -822,7 +826,7 @@ func runSyncCheck(root string, emails []string) error { for _, email := range emails[1:] { // Each client syncs alice's public dir to their local datasites/alice@example.com/public/ - targetDir := filepath.Join(root, email, "datasites", "datasites", src, "public") + targetDir := filepath.Join(root, email, "datasites", src, "public") _ = os.MkdirAll(targetDir, 0o755) // best-effort target := filepath.Join(targetDir, filename) if err := waitForFile(target, content, 45*time.Second); err != nil { @@ -836,8 +840,8 @@ func runSyncCheck(root string, emails []string) error { } func publicPath(root, email string) string { - // Workspace root is //datasites; actual public dir lives under datasites//public - return filepath.Join(root, email, "datasites", "datasites", email, "public") + // Workspace root is /; actual public dir lives under datasites//public + return filepath.Join(root, email, "datasites", email, "public") } // triggerDownloadForAll asks the server to serve the probe for each user to ensure their daemon pulls it. diff --git a/cmd/devstack/performance_test_harness.go b/cmd/devstack/performance_test_harness.go index a99d9be5..2578b8fd 100644 --- a/cmd/devstack/performance_test_harness.go +++ b/cmd/devstack/performance_test_harness.go @@ -66,19 +66,19 @@ type MetricsCollector struct { // TestReport contains test results type TestReport struct { - Duration time.Duration - TotalOps int - SuccessOps int - ErrorOps int - P50Latency time.Duration - P90Latency time.Duration - P95Latency time.Duration - P99Latency time.Duration - AvgThroughput float64 + Duration time.Duration + TotalOps int + SuccessOps int + ErrorOps int + P50Latency time.Duration + P90Latency time.Duration + P95Latency time.Duration + P99Latency time.Duration + AvgThroughput float64 PeakThroughput float64 - ErrorRate float64 - PeakMemoryMB uint64 - AvgCPUPercent float64 + ErrorRate float64 + PeakMemoryMB uint64 + AvgCPUPercent float64 } // NewDevstackHarness creates a test harness with full devstack @@ -209,7 +209,7 @@ func NewDevstackHarness(t *testing.T) *DevstackTestHarness { email: emails[0], state: clients[0], dataDir: clients[0].DataPath, - publicDir: filepath.Join(opts.root, emails[0], "datasites", "datasites", emails[0], "public"), + publicDir: filepath.Join(opts.root, emails[0], "datasites", emails[0], "public"), metrics: &ClientMetrics{}, } @@ -218,7 +218,7 @@ func NewDevstackHarness(t *testing.T) *DevstackTestHarness { email: emails[1], state: clients[1], dataDir: clients[1].DataPath, - publicDir: filepath.Join(opts.root, emails[1], "datasites", "datasites", emails[1], "public"), + publicDir: filepath.Join(opts.root, emails[1], "datasites", emails[1], "public"), metrics: &ClientMetrics{}, } @@ -307,7 +307,7 @@ func (c *ClientHelper) UploadFile(relPath string, content []byte) error { func (c *ClientHelper) WaitForFile(senderEmail, relPath string, expectedMD5 string, timeout time.Duration) error { c.t.Helper() - // File syncs to datasites/datasites/{sender}/public/{relPath} + // File syncs to datasites/{sender}/public/{relPath} fullPath := filepath.Join(c.dataDir, "datasites", senderEmail, "public", relPath) deadline := time.Now().Add(timeout) diff --git a/justfile b/justfile index dbf87505..2b7a3d20 100644 --- a/justfile +++ b/justfile @@ -244,8 +244,8 @@ sbdev-test-perf-sandbox *ARGS: PERF_TEST_SANDBOX="$sandbox_path" go test -v -timeout 30m {{ ARGS }} echo "" echo "Test files preserved in: $sandbox_path" - echo "Files from alice: $sandbox_path/alice@example.com/datasites/datasites/alice@example.com/public/" - echo "Files synced to bob: $sandbox_path/bob@example.com/datasites/datasites/alice@example.com/public/" + echo "Files from alice: $sandbox_path/alice@example.com/datasites/alice@example.com/public/" + echo "Files synced to bob: $sandbox_path/bob@example.com/datasites/alice@example.com/public/" [group('devstack')] sbdev-list: