(t *testing.T)
| 115 | } |
| 116 | |
| 117 | func TestDMap_Put_WriteQuorum(t *testing.T) { |
| 118 | cluster := testcluster.New(NewService) |
| 119 | // Create DMap services with custom configuration |
| 120 | c1 := testutil.NewConfig() |
| 121 | c1.ReplicaCount = 2 |
| 122 | c1.WriteQuorum = 2 |
| 123 | e1 := testcluster.NewEnvironment(c1) |
| 124 | s1 := cluster.AddMember(e1).(*Service) |
| 125 | defer cluster.Shutdown() |
| 126 | |
| 127 | ctx := context.Background() |
| 128 | var hit bool |
| 129 | dm, err := s1.NewDMap("mydmap") |
| 130 | require.NoError(t, err) |
| 131 | |
| 132 | for i := 0; i < 10; i++ { |
| 133 | key := testutil.ToKey(i) |
| 134 | |
| 135 | hkey := partitions.HKey(dm.name, key) |
| 136 | host := dm.s.primary.PartitionByHKey(hkey).Owner() |
| 137 | if s1.rt.This().CompareByID(host) { |
| 138 | err = dm.Put(ctx, key, testutil.ToVal(i), nil) |
| 139 | if err != ErrWriteQuorum { |
| 140 | t.Fatalf("Expected ErrWriteQuorum. Got: %v", err) |
| 141 | } |
| 142 | hit = true |
| 143 | } |
| 144 | } |
| 145 | if !hit { |
| 146 | t.Fatalf("No keys checked on %v", s1) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | func TestDMap_Put_PX(t *testing.T) { |
| 151 | cluster := testcluster.New(NewService) |
nothing calls this directly
no test coverage detected