test(integration): use temp repo paths (#42)

This commit is contained in:
Carlos Florêncio
2026-01-19 16:36:10 +00:00
committed by GitHub
parent c769e69ed7
commit 2582f4b148
2 changed files with 16 additions and 3 deletions
@@ -7,6 +7,8 @@ import (
"encoding/json"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
"sync"
"testing"
@@ -178,11 +180,12 @@ func createWorkspace(t *testing.T, client *WSClient) string {
func createRepository(t *testing.T, client *WSClient, workspaceID string) string {
t.Helper()
repoPath := createTempRepoDir(t)
resp, err := client.SendRequest("repo-1", ws.ActionRepositoryCreate, map[string]interface{}{
"workspace_id": workspaceID,
"name": "Test Repo",
"source_type": "local",
"local_path": "/tmp/repo",
"local_path": repoPath,
})
require.NoError(t, err)
@@ -193,6 +196,16 @@ func createRepository(t *testing.T, client *WSClient, workspaceID string) string
return payload["id"].(string)
}
func createTempRepoDir(t *testing.T) string {
t.Helper()
baseDir := t.TempDir()
repoPath := filepath.Join(baseDir, "repo")
require.NoError(t, os.MkdirAll(repoPath, 0o755))
return repoPath
}
// readPump reads messages from the WebSocket connection
func (c *WSClient) readPump() {
defer close(c.done)
@@ -645,7 +645,7 @@ func (ts *OrchestratorTestServer) CreateTestTask(t *testing.T, agentProfileID st
repository, err := ts.TaskSvc.CreateRepository(context.Background(), &taskservice.CreateRepositoryRequest{
WorkspaceID: workspace.ID,
Name: "Test Repo",
LocalPath: "/tmp/repo",
LocalPath: createTempRepoDir(t),
})
require.NoError(t, err)
@@ -1460,7 +1460,7 @@ func TestOrchestratorEndToEndWorkflow(t *testing.T) {
"workspace_id": workspaceID,
"name": "Test Repo",
"source_type": "local",
"local_path": "/tmp/repo",
"local_path": createTempRepoDir(t),
})
require.NoError(t, err)