MCPcopy
hub / github.com/garethgeorge/backrest / TestSimpleOperationSync

Function TestSimpleOperationSync

internal/api/syncapi/syncapi_test.go:271–394  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

269}
270
271func TestSimpleOperationSync(t *testing.T) {
272 testutil.InstallZapLogger(t)
273 ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
274
275 peerHostAddr := testutil.AllocOpenBindAddr(t)
276 peerClientAddr := testutil.AllocOpenBindAddr(t)
277
278 peerHostConfig := &v1.Config{
279 Version: migrations.CurrentVersion,
280 Instance: defaultHostID,
281 Repos: []*v1.Repo{
282 {
283 Id: defaultRepoID,
284 Guid: defaultRepoGUID,
285 Uri: "test-uri",
286 },
287 },
288 Multihost: &v1.Multihost{
289 Identity: identity1,
290 AuthorizedClients: []*v1.Multihost_Peer{
291 {
292 Keyid: identity2.Keyid,
293 InstanceId: defaultClientID,
294 },
295 },
296 },
297 }
298
299 peerClientConfig := &v1.Config{
300 Version: migrations.CurrentVersion,
301 Instance: defaultClientID,
302 Repos: []*v1.Repo{
303 {
304 Id: defaultRepoID,
305 Guid: defaultRepoGUID,
306 Uri: "backrest://" + defaultHostID, // TODO: get rid of the :// requirement
307 },
308 },
309 Multihost: &v1.Multihost{
310 Identity: identity2,
311 KnownHosts: []*v1.Multihost_Peer{
312 {
313 Keyid: identity1.Keyid,
314 InstanceId: defaultHostID,
315 InstanceUrl: fmt.Sprintf("http://%s", peerHostAddr),
316 Permissions: []*v1.Multihost_Permission{
317 {
318 Type: v1.Multihost_Permission_PERMISSION_READ_OPERATIONS,
319 Scopes: []string{
320 "repo:" + defaultRepoID,
321 },
322 },
323 },
324 },
325 },
326 },
327 }
328

Callers

nothing calls this directly

Calls 11

InstallZapLoggerFunction · 0.92
AllocOpenBindAddrFunction · 0.92
OperationsWithDefaultsFunction · 0.92
newPeerUnderTestFunction · 0.85
startRunningSyncAPIFunction · 0.85
tryConnectFunction · 0.85
tryExpectExactOperationsFunction · 0.85
SetRepoGUIDMethod · 0.80
SetInstanceIDMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected