Skip to content

Commit 3a94042

Browse files
Convert repos integration tests to local acceptance tests (#3200)
## Why The repos integration tests have proved to be a persistent source of flakyness. Converting them to local only improves our CI health. ## Tests The new tests pass and cover everything from the old tests.
1 parent 0bab892 commit 3a94042

File tree

25 files changed

+401
-156
lines changed

25 files changed

+401
-156
lines changed

acceptance/internal/handlers.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,22 @@ func addDefaultHandlers(server *testserver.Server) {
404404
return req.Workspace.VolumesCreate(req)
405405
})
406406

407+
server.Handle("POST", "/api/2.0/repos", func(req testserver.Request) any {
408+
return req.Workspace.ReposCreate(req)
409+
})
410+
411+
server.Handle("GET", "/api/2.0/repos/{repo_id}", func(req testserver.Request) any {
412+
return testserver.MapGet(req.Workspace, req.Workspace.Repos, req.Vars["repo_id"])
413+
})
414+
415+
server.Handle("PATCH", "/api/2.0/repos/{repo_id}", func(req testserver.Request) any {
416+
return req.Workspace.ReposUpdate(req)
417+
})
418+
419+
server.Handle("DELETE", "/api/2.0/repos/{repo_id}", func(req testserver.Request) any {
420+
return req.Workspace.ReposDelete(req)
421+
})
422+
407423
server.Handle("PATCH", "/api/2.1/unity-catalog/volumes/{full_name}", func(req testserver.Request) any {
408424
return req.Workspace.VolumesUpdate(req, req.Vars["full_name"])
409425
})
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"method": "POST",
3+
"path": "/api/2.0/repos",
4+
"body": {
5+
"path": "/Repos/me@databricks.com/test-repo",
6+
"provider": "gitHub",
7+
"url": "https://github.com/databricks/databricks-empty-ide-project.git"
8+
}
9+
}
10+
{
11+
"method": "GET",
12+
"path": "/api/2.0/repos/1"
13+
}
14+
{
15+
"method": "GET",
16+
"path": "/api/2.0/workspace/get-status"
17+
}
18+
{
19+
"method": "GET",
20+
"path": "/api/2.0/repos/1"
21+
}
22+
{
23+
"method": "DELETE",
24+
"path": "/api/2.0/repos/1"
25+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
>>> [CLI] repos create https://github.com/databricks/databricks-empty-ide-project.git gitHub --path /Repos/me@databricks.com/test-repo
3+
4+
=== Get by id should work
5+
>>> [CLI] repos get 1 -o json
6+
{
7+
"branch":"main",
8+
"id":1,
9+
"path":"/Repos/me@databricks.com/test-repo",
10+
"provider":"gitHub",
11+
"url":"https://github.com/databricks/databricks-empty-ide-project.git"
12+
}
13+
14+
=== Get by path should work
15+
>>> [CLI] repos get /Repos/me@databricks.com/test-repo -o json
16+
{
17+
"branch":"main",
18+
"id":1,
19+
"path":"/Repos/me@databricks.com/test-repo",
20+
"provider":"gitHub",
21+
"url":"https://github.com/databricks/databricks-empty-ide-project.git"
22+
}
23+
24+
=== Delete by id should work
25+
>>> [CLI] repos delete 1
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
url=https://github.com/databricks/databricks-empty-ide-project.git
2+
provider=gitHub
3+
path=/Repos/me@databricks.com/test-repo
4+
5+
repo_id=$(trace $CLI repos create $url $provider --path $path | jq .id -r)
6+
7+
title "Get by id should work"
8+
trace $CLI repos get $repo_id -o json
9+
10+
title "Get by path should work"
11+
trace $CLI repos get $path -o json
12+
13+
title "Delete by id should work"
14+
trace $CLI repos delete $repo_id
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"method": "POST",
3+
"path": "/api/2.0/repos",
4+
"body": {
5+
"path": "/Repos/me@databricks.com/test-repo",
6+
"provider": "gitHub",
7+
"url": "https://github.com/databricks/databricks-empty-ide-project.git"
8+
}
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Local = true
2+
Cloud = false
3+
4+
[EnvMatrix]
5+
DATABRICKS_CLI_DEPLOYMENT = ["terraform", "direct-exp"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
>>> [CLI] repos create https://github.com/databricks/databricks-empty-ide-project.git --path /Repos/me@databricks.com/test-repo
3+
{
4+
"branch":"main",
5+
"id":1,
6+
"path":"/Repos/me@databricks.com/test-repo",
7+
"provider":"gitHub",
8+
"url":"https://github.com/databricks/databricks-empty-ide-project.git"
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
url=https://github.com/databricks/databricks-empty-ide-project.git
2+
path=/Repos/me@databricks.com/test-repo
3+
4+
trace $CLI repos create $url --path $path
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"method": "POST",
3+
"path": "/api/2.0/repos",
4+
"body": {
5+
"path": "/Repos/me@databricks.com/test-repo",
6+
"provider": "gitHub",
7+
"url": "https://github.com/databricks/databricks-empty-ide-project.git"
8+
}
9+
}
10+
{
11+
"method": "GET",
12+
"path": "/api/2.0/workspace/get-status"
13+
}
14+
{
15+
"method": "GET",
16+
"path": "/api/2.0/repos/1"
17+
}
18+
{
19+
"method": "GET",
20+
"path": "/api/2.0/workspace/get-status"
21+
}
22+
{
23+
"method": "DELETE",
24+
"path": "/api/2.0/repos/1"
25+
}
26+
{
27+
"method": "GET",
28+
"path": "/api/2.0/workspace/get-status"
29+
}

0 commit comments

Comments
 (0)