tools: persist spark_submit calls to SubmissionRepo
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,7 @@ import (
|
||||
|
||||
// testDepsWithDataDir returns dependencies backed by an in-memory DB and a
|
||||
// temporary data directory.
|
||||
func testDepsWithDataDir(t *testing.T) (*Deps, *storage.ClusterRepo, *audit.Repo) {
|
||||
func testDepsWithDataDir(t *testing.T) (*Deps, *storage.ClusterRepo, *storage.SubmissionRepo, *audit.Repo) {
|
||||
t.Helper()
|
||||
db, err := storage.Open(":memory:")
|
||||
if err != nil {
|
||||
@@ -46,10 +46,11 @@ func testDepsWithDataDir(t *testing.T) (*Deps, *storage.ClusterRepo, *audit.Repo
|
||||
}),
|
||||
AuditRepo: audit.NewRepo(db),
|
||||
ClusterRepo: db.Clusters(),
|
||||
SubmissionRepo: db.Submissions(),
|
||||
MaxResponseBytes: 1 << 20,
|
||||
DataDir: dataDir,
|
||||
UploadStore: uploadStore,
|
||||
}, db.Clusters(), audit.NewRepo(db)
|
||||
}, db.Clusters(), db.Submissions(), audit.NewRepo(db)
|
||||
}
|
||||
|
||||
// createCluster creates a cluster in the repository with the given fields.
|
||||
@@ -100,7 +101,7 @@ func TestFetchURL(t *testing.T) {
|
||||
}))
|
||||
defer srv.Close()
|
||||
|
||||
deps, repo, _ := testDepsWithDataDir(t)
|
||||
deps, repo, _, _ := testDepsWithDataDir(t)
|
||||
createCluster(t, repo, &cluster.Cluster{
|
||||
ID: "cluster-a",
|
||||
Name: "Cluster A",
|
||||
@@ -294,7 +295,7 @@ func TestFetchURL_RedirectPreservesAuth(t *testing.T) {
|
||||
}))
|
||||
defer server1.Close()
|
||||
|
||||
deps, repo, _ := testDepsWithDataDir(t)
|
||||
deps, repo, _, _ := testDepsWithDataDir(t)
|
||||
createCluster(t, repo, &cluster.Cluster{
|
||||
ID: "cluster-redirect",
|
||||
Name: "Redirect",
|
||||
@@ -323,7 +324,7 @@ func TestFetchURL_RedirectPreservesAuth(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadFile(t *testing.T) {
|
||||
deps, _, auditRepo := testDepsWithDataDir(t)
|
||||
deps, _, _, auditRepo := testDepsWithDataDir(t)
|
||||
|
||||
req := newToolRequest(UploadFileName, map[string]any{
|
||||
"filename": "hello.txt",
|
||||
@@ -387,7 +388,7 @@ func TestUploadFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadFile_PathTraversal(t *testing.T) {
|
||||
deps, _, _ := testDepsWithDataDir(t)
|
||||
deps, _, _, _ := testDepsWithDataDir(t)
|
||||
|
||||
cases := []string{
|
||||
"../../../etc/passwd",
|
||||
@@ -418,7 +419,7 @@ func TestUploadFile_PathTraversal(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadFile_Base64(t *testing.T) {
|
||||
deps, _, _ := testDepsWithDataDir(t)
|
||||
deps, _, _, _ := testDepsWithDataDir(t)
|
||||
|
||||
req := newToolRequest(UploadFileName, map[string]any{
|
||||
"filename": "hello.bin",
|
||||
|
||||
Reference in New Issue
Block a user