From 0caf562a42732ca33547e2d21f8b5c0df0c97b1d Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Tue, 13 Oct 2026 14:15:25 +0000 Subject: [PATCH 1/5] Use short workspace IDs in the acceptance test server --- acceptance/replacements_test.go | 49 ++++++++++++++++++++++++++++ acceptance/test.toml | 6 ++++ libs/testserver/alerts.go | 2 +- libs/testserver/bundledeployments.go | 2 +- libs/testserver/fake_workspace.go | 30 ++++++++++------- libs/testserver/handlers.go | 2 +- libs/testserver/repos.go | 2 +- libs/testserver/workspace_test.go | 30 +++++++++++++++++ 8 files changed, 108 insertions(+), 15 deletions(-) create mode 100644 acceptance/replacements_test.go diff --git a/acceptance/replacements_test.go b/acceptance/replacements_test.go new file mode 100644 index 00000000000..eb8581ef860 --- /dev/null +++ b/acceptance/replacements_test.go @@ -0,0 +1,49 @@ +package acceptance_test + +import ( + "testing" + + "github.com/BurntSushi/toml" + "github.com/databricks/cli/acceptance/internal" + "github.com/databricks/cli/libs/testdiff" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestDeploymentIDReplacement(t *testing.T) { + var config internal.TestConfig + _, err := toml.DecodeFile("test.toml", &config) + require.NoError(t, err) + repls := testdiff.ReplacementsContext{Repls: config.Repls} + + for _, tc := range []struct { + name string + old string + new string + }{ + { + name: "short ID", + old: `/api/2.0/bundle/deployments/12/versions/2/operations/jobs.foo`, + new: `/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/2/operations/jobs.foo`, + }, + { + name: "long ID", + old: `"name": "deployments/8900000000000000001"`, + new: `"name": "deployments/[DEPLOYMENT_ID]"`, + }, + { + name: "versions and counts", + old: `{"version_id":"12","sequence_id":12,"count":12}`, + new: `{"version_id":"12","sequence_id":12,"count":12}`, + }, + { + name: "nonnumeric ID", + old: `deployments/12abc`, + new: `deployments/12abc`, + }, + } { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.new, repls.Replace(tc.old)) + }) + } +} diff --git a/acceptance/test.toml b/acceptance/test.toml index 9c16370c07b..3d08fc3d74b 100644 --- a/acceptance/test.toml +++ b/acceptance/test.toml @@ -81,3 +81,9 @@ New = 'json.plan_version = [PLAN_VERSION];' # The lineage hash (libs/shortid) is not masked: fixture lineages hash to stable values, and # tests with a freshly minted lineage register its hash with read_lineage.py. + +# Workspace TreeIDs can be short (for example, in LITE). Match the deployment path +# rather than arbitrary numbers so version numbers and counts stay visible. +[[Repls]] +Old = '\bdeployments/[0-9]+\b' +New = 'deployments/[DEPLOYMENT_ID]' diff --git a/libs/testserver/alerts.go b/libs/testserver/alerts.go index 572dfe68e0e..460c0cde805 100644 --- a/libs/testserver/alerts.go +++ b/libs/testserver/alerts.go @@ -143,7 +143,7 @@ func (s *FakeWorkspace) writeAlertFile(alert sql.AlertV2) error { Info: workspace.ObjectInfo{ ObjectType: "FILE", Path: filePath, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, Data: data, } diff --git a/libs/testserver/bundledeployments.go b/libs/testserver/bundledeployments.go index b4019b75d0a..9866cc973ed 100644 --- a/libs/testserver/bundledeployments.go +++ b/libs/testserver/bundledeployments.go @@ -74,7 +74,7 @@ func (s *FakeWorkspace) CreateDeployment(req Request) Response { if resp, ok := s.requireParentDirectory(nodePath); !ok { return resp } - objectID := nextID() + objectID := nextWorkspaceID() s.files[nodePath] = FileEntry{ Info: workspace.ObjectInfo{ // The service registers its own node type, which get-status reports back; diff --git a/libs/testserver/fake_workspace.go b/libs/testserver/fake_workspace.go index 38181c2d1f0..6782952e353 100644 --- a/libs/testserver/fake_workspace.go +++ b/libs/testserver/fake_workspace.go @@ -16,6 +16,7 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "time" "github.com/databricks/databricks-sdk-go/service/compute" @@ -99,8 +100,15 @@ var ( idMutex sync.Mutex lastNowNano int64 lastNowMilli int64 + workspaceID atomic.Int64 ) +// nextWorkspaceID starts above common version numbers and counts, which scripts +// can otherwise mask when registering literal ID replacements. +func nextWorkspaceID() int64 { + return 1000 + workspaceID.Add(1) +} + // IDs are prefixed with 7 and padded to avoid matching regex 1[78]\d{14} func nextID() int64 { // offset enough so that it does not match UNIX_TIME_NANO regex @@ -444,22 +452,22 @@ func NewFakeWorkspace(url, token string) *FakeWorkspace { "/Workspace": { ObjectType: "DIRECTORY", Path: "/Workspace", - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, "/Users": { ObjectType: "DIRECTORY", Path: "/Users", - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, "/Users/" + TestUser.UserName: { ObjectType: "DIRECTORY", Path: "/Users/" + TestUser.UserName, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, "/Users/" + TestUserSP.UserName: { ObjectType: "DIRECTORY", Path: "/Users/" + TestUserSP.UserName, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, // The user home also exists under the /Workspace alias on real // workspaces, so model it here too. Imports require the parent @@ -467,17 +475,17 @@ func NewFakeWorkspace(url, token string) *FakeWorkspace { "/Workspace/Users": { ObjectType: "DIRECTORY", Path: "/Workspace/Users", - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, "/Workspace/Users/" + TestUser.UserName: { ObjectType: "DIRECTORY", Path: "/Workspace/Users/" + TestUser.UserName, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, "/Workspace/Users/" + TestUserSP.UserName: { ObjectType: "DIRECTORY", Path: "/Workspace/Users/" + TestUserSP.UserName, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, }, files: make(map[string]FileEntry), @@ -824,7 +832,7 @@ func (s *FakeWorkspace) WorkspaceMkdirs(request workspace.Mkdirs) { s.directories[dir] = workspace.ObjectInfo{ ObjectType: "DIRECTORY", Path: dir, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), } } } @@ -1049,7 +1057,7 @@ func (s *FakeWorkspace) importFile(filePath string, body []byte, overwrite, dete ObjectType: "NOTEBOOK", Path: workspacePath, Language: lang, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, Data: body, } @@ -1061,7 +1069,7 @@ func (s *FakeWorkspace) importFile(filePath string, body []byte, overwrite, dete Info: workspace.ObjectInfo{ ObjectType: "FILE", Path: workspacePath, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, Data: body, } @@ -1119,7 +1127,7 @@ func (s *FakeWorkspace) WorkspaceImportNotebook(filePath string, body []byte, la ObjectType: "NOTEBOOK", Path: filePath, Language: language, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), }, Data: body, } diff --git a/libs/testserver/handlers.go b/libs/testserver/handlers.go index a2d0be14760..e7bf6f2714c 100644 --- a/libs/testserver/handlers.go +++ b/libs/testserver/handlers.go @@ -405,7 +405,7 @@ func AddDefaultHandlers(server *Server) { req.Workspace.directories[dir] = workspace.ObjectInfo{ ObjectType: "DIRECTORY", Path: dir, - ObjectId: nextID(), + ObjectId: nextWorkspaceID(), } } } diff --git a/libs/testserver/repos.go b/libs/testserver/repos.go index 9e3f3d5bd18..d60b5faa1e2 100644 --- a/libs/testserver/repos.go +++ b/libs/testserver/repos.go @@ -26,7 +26,7 @@ func (s *FakeWorkspace) ReposCreate(req Request) Response { } } - repoId := nextID() + repoId := nextWorkspaceID() id := strconv.FormatInt(repoId, 10) repoInfo := workspace.RepoInfo{ diff --git a/libs/testserver/workspace_test.go b/libs/testserver/workspace_test.go index 401758c6648..32857c81871 100644 --- a/libs/testserver/workspace_test.go +++ b/libs/testserver/workspace_test.go @@ -7,10 +7,40 @@ import ( "testing" "github.com/databricks/cli/libs/testserver" + "github.com/databricks/databricks-sdk-go/service/workspace" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +func TestWorkspaceIDsAreShortAndUnique(t *testing.T) { + w := testserver.NewFakeWorkspace("https://workspace.test", "test-token") + w.WorkspaceMkdirs(workspace.Mkdirs{Path: "/test-dir"}) + require.Zero(t, w.WorkspaceFilesImportFile("/test-dir/file.txt", []byte("content"), false).StatusCode) + require.Zero(t, w.WorkspaceImportNotebook("/test-dir/notebook", []byte("content"), workspace.LanguagePython, false).StatusCode) + require.Zero(t, w.ReposCreate(testserver.Request{Body: []byte(`{"path":"/Repos/me/repo","url":"https://github.com/databricks/cli","provider":"gitHub"}`)}).StatusCode) + response := w.CreateDeployment(testserver.Request{Body: []byte(`{"initial_parent_path":"/test-dir"}`)}) + require.Zero(t, response.StatusCode) + + seen := make(map[int64]bool) + for _, path := range []string{ + "/Workspace", + "/Users", + "/test-dir", + "/test-dir/file.txt", + "/test-dir/notebook", + "/Repos/me/repo", + "/test-dir/resources.deployment.json", + } { + response := w.WorkspaceGetStatus(path, false) + require.Zero(t, response.StatusCode, path) + info := response.Body.(workspace.ObjectInfo) + assert.Greater(t, info.ObjectId, int64(1000), path) + assert.Less(t, info.ObjectId, int64(1_000_000), path) + assert.False(t, seen[info.ObjectId], "duplicate ID for %s", path) + seen[info.ObjectId] = true + } +} + func importFile(t *testing.T, baseURL, path, body string) int { t.Helper() req, _ := http.NewRequest(http.MethodPost, baseURL+"/api/2.0/workspace-files/import-file/"+strings.TrimPrefix(path, "/")+"?overwrite=true", strings.NewReader(body)) From eb79e62935b1cfb16fee9e9085321d1a3a534f6a Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 14 Oct 2026 11:53:17 +0000 Subject: [PATCH 2/5] Normalize workspace list header widths in migration tests --- acceptance/bundle/migrate/test.toml | 5 +++++ acceptance/replacements_test.go | 33 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/acceptance/bundle/migrate/test.toml b/acceptance/bundle/migrate/test.toml index ec69d990564..d0dd61c2d3b 100644 --- a/acceptance/bundle/migrate/test.toml +++ b/acceptance/bundle/migrate/test.toml @@ -18,3 +18,8 @@ EnvMatrix.DMS = [""] [[Repls]] Old = '(?m)^\d+(\s+FILE)' New = '[OBJECT_ID]${1}' + +# The ID column width depends on ID length, not migration behavior. +[[Repls]] +Old = '(?m)^ID +Type Language Path$' +New = 'ID Type Language Path' diff --git a/acceptance/replacements_test.go b/acceptance/replacements_test.go index eb8581ef860..a0ec180d477 100644 --- a/acceptance/replacements_test.go +++ b/acceptance/replacements_test.go @@ -47,3 +47,36 @@ func TestDeploymentIDReplacement(t *testing.T) { }) } } + +func TestWorkspaceListHeaderReplacement(t *testing.T) { + var config internal.TestConfig + _, err := toml.DecodeFile("bundle/migrate/test.toml", &config) + require.NoError(t, err) + repls := testdiff.ReplacementsContext{Repls: config.Repls} + + for _, tc := range []struct { + name string + old string + new string + }{ + { + name: "four-digit IDs", + old: "ID Type Language Path\n", + new: "ID Type Language Path\n", + }, + { + name: "five-digit IDs", + old: "ID Type Language Path\n", + new: "ID Type Language Path\n", + }, + { + name: "other table", + old: "ID Name\n", + new: "ID Name\n", + }, + } { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.new, repls.Replace(tc.old)) + }) + } +} From 1965f68fb6e00c3efb62696e003b18f201b74593 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 14 Oct 2026 11:57:44 +0000 Subject: [PATCH 3/5] Keep workspace ID row padding stable across digit counts --- acceptance/bundle/migrate/test.toml | 4 ++-- acceptance/replacements_test.go | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/acceptance/bundle/migrate/test.toml b/acceptance/bundle/migrate/test.toml index d0dd61c2d3b..bc9174120a7 100644 --- a/acceptance/bundle/migrate/test.toml +++ b/acceptance/bundle/migrate/test.toml @@ -16,8 +16,8 @@ EnvMatrix.DMS = [""] # workspace list prints each state file's object id, minted per run. [[Repls]] -Old = '(?m)^\d+(\s+FILE)' -New = '[OBJECT_ID]${1}' +Old = '(?m)^\d+ +FILE\b' +New = '[OBJECT_ID] FILE' # The ID column width depends on ID length, not migration behavior. [[Repls]] diff --git a/acceptance/replacements_test.go b/acceptance/replacements_test.go index a0ec180d477..5e163ba2bec 100644 --- a/acceptance/replacements_test.go +++ b/acceptance/replacements_test.go @@ -48,7 +48,7 @@ func TestDeploymentIDReplacement(t *testing.T) { } } -func TestWorkspaceListHeaderReplacement(t *testing.T) { +func TestWorkspaceListReplacement(t *testing.T) { var config internal.TestConfig _, err := toml.DecodeFile("bundle/migrate/test.toml", &config) require.NoError(t, err) @@ -69,6 +69,11 @@ func TestWorkspaceListHeaderReplacement(t *testing.T) { old: "ID Type Language Path\n", new: "ID Type Language Path\n", }, + { + name: "mixed ID widths", + old: "9999 FILE /state/old.json\n10000 FILE /state/new.json\n", + new: "[OBJECT_ID] FILE /state/old.json\n[OBJECT_ID] FILE /state/new.json\n", + }, { name: "other table", old: "ID Name\n", From bac169eb163fb82ae31e999731f6f7e4a842416d Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 14 Oct 2026 12:44:26 +0000 Subject: [PATCH 4/5] Remove dedicated short-ID infrastructure tests --- acceptance/replacements_test.go | 87 ------------------------------- libs/testserver/workspace_test.go | 30 ----------- 2 files changed, 117 deletions(-) delete mode 100644 acceptance/replacements_test.go diff --git a/acceptance/replacements_test.go b/acceptance/replacements_test.go deleted file mode 100644 index 5e163ba2bec..00000000000 --- a/acceptance/replacements_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package acceptance_test - -import ( - "testing" - - "github.com/BurntSushi/toml" - "github.com/databricks/cli/acceptance/internal" - "github.com/databricks/cli/libs/testdiff" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestDeploymentIDReplacement(t *testing.T) { - var config internal.TestConfig - _, err := toml.DecodeFile("test.toml", &config) - require.NoError(t, err) - repls := testdiff.ReplacementsContext{Repls: config.Repls} - - for _, tc := range []struct { - name string - old string - new string - }{ - { - name: "short ID", - old: `/api/2.0/bundle/deployments/12/versions/2/operations/jobs.foo`, - new: `/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/2/operations/jobs.foo`, - }, - { - name: "long ID", - old: `"name": "deployments/8900000000000000001"`, - new: `"name": "deployments/[DEPLOYMENT_ID]"`, - }, - { - name: "versions and counts", - old: `{"version_id":"12","sequence_id":12,"count":12}`, - new: `{"version_id":"12","sequence_id":12,"count":12}`, - }, - { - name: "nonnumeric ID", - old: `deployments/12abc`, - new: `deployments/12abc`, - }, - } { - t.Run(tc.name, func(t *testing.T) { - assert.Equal(t, tc.new, repls.Replace(tc.old)) - }) - } -} - -func TestWorkspaceListReplacement(t *testing.T) { - var config internal.TestConfig - _, err := toml.DecodeFile("bundle/migrate/test.toml", &config) - require.NoError(t, err) - repls := testdiff.ReplacementsContext{Repls: config.Repls} - - for _, tc := range []struct { - name string - old string - new string - }{ - { - name: "four-digit IDs", - old: "ID Type Language Path\n", - new: "ID Type Language Path\n", - }, - { - name: "five-digit IDs", - old: "ID Type Language Path\n", - new: "ID Type Language Path\n", - }, - { - name: "mixed ID widths", - old: "9999 FILE /state/old.json\n10000 FILE /state/new.json\n", - new: "[OBJECT_ID] FILE /state/old.json\n[OBJECT_ID] FILE /state/new.json\n", - }, - { - name: "other table", - old: "ID Name\n", - new: "ID Name\n", - }, - } { - t.Run(tc.name, func(t *testing.T) { - assert.Equal(t, tc.new, repls.Replace(tc.old)) - }) - } -} diff --git a/libs/testserver/workspace_test.go b/libs/testserver/workspace_test.go index 32857c81871..401758c6648 100644 --- a/libs/testserver/workspace_test.go +++ b/libs/testserver/workspace_test.go @@ -7,40 +7,10 @@ import ( "testing" "github.com/databricks/cli/libs/testserver" - "github.com/databricks/databricks-sdk-go/service/workspace" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func TestWorkspaceIDsAreShortAndUnique(t *testing.T) { - w := testserver.NewFakeWorkspace("https://workspace.test", "test-token") - w.WorkspaceMkdirs(workspace.Mkdirs{Path: "/test-dir"}) - require.Zero(t, w.WorkspaceFilesImportFile("/test-dir/file.txt", []byte("content"), false).StatusCode) - require.Zero(t, w.WorkspaceImportNotebook("/test-dir/notebook", []byte("content"), workspace.LanguagePython, false).StatusCode) - require.Zero(t, w.ReposCreate(testserver.Request{Body: []byte(`{"path":"/Repos/me/repo","url":"https://github.com/databricks/cli","provider":"gitHub"}`)}).StatusCode) - response := w.CreateDeployment(testserver.Request{Body: []byte(`{"initial_parent_path":"/test-dir"}`)}) - require.Zero(t, response.StatusCode) - - seen := make(map[int64]bool) - for _, path := range []string{ - "/Workspace", - "/Users", - "/test-dir", - "/test-dir/file.txt", - "/test-dir/notebook", - "/Repos/me/repo", - "/test-dir/resources.deployment.json", - } { - response := w.WorkspaceGetStatus(path, false) - require.Zero(t, response.StatusCode, path) - info := response.Body.(workspace.ObjectInfo) - assert.Greater(t, info.ObjectId, int64(1000), path) - assert.Less(t, info.ObjectId, int64(1_000_000), path) - assert.False(t, seen[info.ObjectId], "duplicate ID for %s", path) - seen[info.ObjectId] = true - } -} - func importFile(t *testing.T, baseURL, path, body string) int { t.Helper() req, _ := http.NewRequest(http.MethodPost, baseURL+"/api/2.0/workspace-files/import-file/"+strings.TrimPrefix(path, "/")+"?overwrite=true", strings.NewReader(body)) From b28d2786f1802dbd661b91e53357a74ee03c6853 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 14 Oct 2026 12:50:42 +0000 Subject: [PATCH 5/5] Rename workspace ID helper to nextTreenodeID --- libs/testserver/alerts.go | 2 +- libs/testserver/bundledeployments.go | 2 +- libs/testserver/fake_workspace.go | 26 +++++++++++++------------- libs/testserver/handlers.go | 2 +- libs/testserver/repos.go | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libs/testserver/alerts.go b/libs/testserver/alerts.go index 460c0cde805..48612ad539d 100644 --- a/libs/testserver/alerts.go +++ b/libs/testserver/alerts.go @@ -143,7 +143,7 @@ func (s *FakeWorkspace) writeAlertFile(alert sql.AlertV2) error { Info: workspace.ObjectInfo{ ObjectType: "FILE", Path: filePath, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, Data: data, } diff --git a/libs/testserver/bundledeployments.go b/libs/testserver/bundledeployments.go index 9866cc973ed..86aef24d83c 100644 --- a/libs/testserver/bundledeployments.go +++ b/libs/testserver/bundledeployments.go @@ -74,7 +74,7 @@ func (s *FakeWorkspace) CreateDeployment(req Request) Response { if resp, ok := s.requireParentDirectory(nodePath); !ok { return resp } - objectID := nextWorkspaceID() + objectID := nextTreenodeID() s.files[nodePath] = FileEntry{ Info: workspace.ObjectInfo{ // The service registers its own node type, which get-status reports back; diff --git a/libs/testserver/fake_workspace.go b/libs/testserver/fake_workspace.go index 6782952e353..d55e336e88a 100644 --- a/libs/testserver/fake_workspace.go +++ b/libs/testserver/fake_workspace.go @@ -103,9 +103,9 @@ var ( workspaceID atomic.Int64 ) -// nextWorkspaceID starts above common version numbers and counts, which scripts +// nextTreenodeID starts above common version numbers and counts, which scripts // can otherwise mask when registering literal ID replacements. -func nextWorkspaceID() int64 { +func nextTreenodeID() int64 { return 1000 + workspaceID.Add(1) } @@ -452,22 +452,22 @@ func NewFakeWorkspace(url, token string) *FakeWorkspace { "/Workspace": { ObjectType: "DIRECTORY", Path: "/Workspace", - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, "/Users": { ObjectType: "DIRECTORY", Path: "/Users", - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, "/Users/" + TestUser.UserName: { ObjectType: "DIRECTORY", Path: "/Users/" + TestUser.UserName, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, "/Users/" + TestUserSP.UserName: { ObjectType: "DIRECTORY", Path: "/Users/" + TestUserSP.UserName, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, // The user home also exists under the /Workspace alias on real // workspaces, so model it here too. Imports require the parent @@ -475,17 +475,17 @@ func NewFakeWorkspace(url, token string) *FakeWorkspace { "/Workspace/Users": { ObjectType: "DIRECTORY", Path: "/Workspace/Users", - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, "/Workspace/Users/" + TestUser.UserName: { ObjectType: "DIRECTORY", Path: "/Workspace/Users/" + TestUser.UserName, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, "/Workspace/Users/" + TestUserSP.UserName: { ObjectType: "DIRECTORY", Path: "/Workspace/Users/" + TestUserSP.UserName, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, }, files: make(map[string]FileEntry), @@ -832,7 +832,7 @@ func (s *FakeWorkspace) WorkspaceMkdirs(request workspace.Mkdirs) { s.directories[dir] = workspace.ObjectInfo{ ObjectType: "DIRECTORY", Path: dir, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), } } } @@ -1057,7 +1057,7 @@ func (s *FakeWorkspace) importFile(filePath string, body []byte, overwrite, dete ObjectType: "NOTEBOOK", Path: workspacePath, Language: lang, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, Data: body, } @@ -1069,7 +1069,7 @@ func (s *FakeWorkspace) importFile(filePath string, body []byte, overwrite, dete Info: workspace.ObjectInfo{ ObjectType: "FILE", Path: workspacePath, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, Data: body, } @@ -1127,7 +1127,7 @@ func (s *FakeWorkspace) WorkspaceImportNotebook(filePath string, body []byte, la ObjectType: "NOTEBOOK", Path: filePath, Language: language, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), }, Data: body, } diff --git a/libs/testserver/handlers.go b/libs/testserver/handlers.go index e7bf6f2714c..04455a6be76 100644 --- a/libs/testserver/handlers.go +++ b/libs/testserver/handlers.go @@ -405,7 +405,7 @@ func AddDefaultHandlers(server *Server) { req.Workspace.directories[dir] = workspace.ObjectInfo{ ObjectType: "DIRECTORY", Path: dir, - ObjectId: nextWorkspaceID(), + ObjectId: nextTreenodeID(), } } } diff --git a/libs/testserver/repos.go b/libs/testserver/repos.go index d60b5faa1e2..30c090b5b41 100644 --- a/libs/testserver/repos.go +++ b/libs/testserver/repos.go @@ -26,7 +26,7 @@ func (s *FakeWorkspace) ReposCreate(req Request) Response { } } - repoId := nextWorkspaceID() + repoId := nextTreenodeID() id := strconv.FormatInt(repoId, 10) repoInfo := workspace.RepoInfo{