(t *testing.T)
| 170 | } |
| 171 | |
| 172 | func TestRefreshFeaturesRecord(t *testing.T) { |
| 173 | percentages := []uint32{0, 10, testAccountHash - 1, testAccountHash, testAccountHash + 1, 100, 101, 1000} |
| 174 | selector := newTestSelector(t, percentages, false, time.Minute) |
| 175 | |
| 176 | // Starting out should default to DatagramV2 |
| 177 | snapshot := selector.Snapshot() |
| 178 | require.Equal(t, DatagramV2, snapshot.DatagramVersion) |
| 179 | |
| 180 | for _, percentage := range percentages { |
| 181 | snapshot = selector.Snapshot() |
| 182 | if percentage > testAccountHash { |
| 183 | require.Equal(t, DatagramV3, snapshot.DatagramVersion) |
| 184 | } else { |
| 185 | require.Equal(t, DatagramV2, snapshot.DatagramVersion) |
| 186 | } |
| 187 | |
| 188 | // Manually progress the next refresh |
| 189 | _ = selector.refresh(t.Context()) |
| 190 | } |
| 191 | |
| 192 | // Make sure a resolver error doesn't override the last fetched features |
| 193 | snapshot = selector.Snapshot() |
| 194 | require.Equal(t, DatagramV3, snapshot.DatagramVersion) |
| 195 | } |
| 196 | |
| 197 | func TestSnapshotIsolation(t *testing.T) { |
| 198 | percentages := []uint32{testAccountHash, testAccountHash + 1} |
nothing calls this directly
no test coverage detected