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

Function TestSyncMutations

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

Source from the content-addressed store, hash-verified

394}
395
396func TestSyncMutations(t *testing.T) {
397 testutil.InstallZapLogger(t)
398 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
399 defer cancel()
400
401 peerHostAddr := testutil.AllocOpenBindAddr(t)
402 peerClientAddr := testutil.AllocOpenBindAddr(t)
403
404 peerHostConfig := &v1.Config{
405 Version: migrations.CurrentVersion,
406 Instance: defaultHostID,
407 Repos: []*v1.Repo{
408 {
409 Id: defaultRepoID,
410 Guid: defaultRepoGUID,
411 Uri: "test-uri",
412 },
413 },
414 Multihost: &v1.Multihost{
415 Identity: identity1,
416 AuthorizedClients: []*v1.Multihost_Peer{
417 {
418 Keyid: identity2.Keyid,
419 InstanceId: defaultClientID,
420 },
421 },
422 },
423 }
424
425 peerClientConfig := &v1.Config{
426 Version: migrations.CurrentVersion,
427 Instance: defaultClientID,
428 Repos: []*v1.Repo{
429 {
430 Id: defaultRepoID,
431 Guid: defaultRepoGUID,
432 Uri: "backrest://" + defaultHostID, // TODO: get rid of the :// requirement
433 },
434 },
435 Multihost: &v1.Multihost{
436 Identity: identity2,
437 KnownHosts: []*v1.Multihost_Peer{
438 {
439 Keyid: identity1.Keyid,
440 InstanceId: defaultHostID,
441 InstanceUrl: fmt.Sprintf("http://%s", peerHostAddr),
442 Permissions: []*v1.Multihost_Permission{
443 {
444 Type: v1.Multihost_Permission_PERMISSION_READ_OPERATIONS,
445 Scopes: []string{
446 "repo:" + defaultRepoID,
447 },
448 },
449 },
450 },
451 },
452 },
453 }

Callers

nothing calls this directly

Calls 12

InstallZapLoggerFunction · 0.92
AllocOpenBindAddrFunction · 0.92
OperationsWithDefaultsFunction · 0.92
newPeerUnderTestFunction · 0.85
runSyncAPIWithCtxFunction · 0.85
tryConnectFunction · 0.85
tryExpectExactOperationsFunction · 0.85
DoneMethod · 0.80
SetRepoGUIDMethod · 0.80
AddMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected