MCPcopy Index your code
hub / github.com/dnote/dnote / switchToEmptyServer

Function switchToEmptyServer

pkg/e2e/sync/testutils.go:135–145  ·  view source on GitHub ↗

switchToEmptyServer closes the current server and creates a new empty server, updating the config file to point to it.

(t *testing.T, env *testEnv)

Source from the content-addressed store, hash-verified

133// switchToEmptyServer closes the current server and creates a new empty server,
134// updating the config file to point to it.
135func switchToEmptyServer(t *testing.T, env *testEnv) {
136 // Close old server
137 env.Server.Close()
138
139 // Create new empty server
140 env.Server, env.ServerDB = setupNewServer(t)
141
142 // Update config file to point to new server
143 apiEndpoint := fmt.Sprintf("%s/api", env.Server.URL)
144 updateConfigAPIEndpoint(t, env.TmpDir, apiEndpoint)
145}
146
147// setupUser creates a test user in the server database
148func setupUser(t *testing.T, env testEnv) database.User {

Callers 2

TestSync_EmptyServerFunction · 0.85

Calls 3

setupNewServerFunction · 0.85
updateConfigAPIEndpointFunction · 0.85
CloseMethod · 0.65

Tested by 2

TestSync_EmptyServerFunction · 0.68