Skip to content
Snippets Groups Projects
Commit 23e58e82 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

fixed bug in constructTimestamps where rand was used instead of rng

parent 0f3e1a9f
No related branches found
No related tags found
No related merge requests found
...@@ -159,8 +159,8 @@ func TestCollector_ApplyChanges(t *testing.T) { ...@@ -159,8 +159,8 @@ func TestCollector_ApplyChanges(t *testing.T) {
value := []byte(fmt.Sprintf("Value%d%d", i, j)) value := []byte(fmt.Sprintf("Value%d%d", i, j))
mutation := NewMutate(timestamps[tsIdx], mutation := NewMutate(timestamps[tsIdx],
value, false) value, false)
// t.Logf("%s: %s -> %s @ ts: %s", txLog.state.myID, t.Logf("%s: %s -> %s @ ts: %s", txLog.state.myID,
// key, string(value), timestamps[tsIdx]) key, string(value), timestamps[tsIdx])
txLog.state.AddUnsafe(key, mutation) txLog.state.AddUnsafe(key, mutation)
} }
serial, err := txLog.state.Serialize() serial, err := txLog.state.Serialize()
...@@ -204,13 +204,13 @@ func TestCollector_ApplyChanges(t *testing.T) { ...@@ -204,13 +204,13 @@ func TestCollector_ApplyChanges(t *testing.T) {
// These are generated from a previous run, they're always the same due // These are generated from a previous run, they're always the same due
// to the entropy source // to the entropy source
expectedVals := []int{20, 11, 12, 33, 14, 15} expectedVals := []int{30, 11, 12, 23, 24, 15}
for i := 0; i < 6; i++ { for i := 0; i < 6; i++ {
key := fmt.Sprintf("Key%d", i) key := fmt.Sprintf("Key%d", i)
val, err := remoteKv.remote.GetBytes(key) val, err := remoteKv.remote.GetBytes(key)
require.NoError(t, err, key) require.NoError(t, err, key)
expectedVal := fmt.Sprintf("Value%d", expectedVals[i]) expectedVal := fmt.Sprintf("Value%d", expectedVals[i])
// t.Logf("Change: %s -> %s", key, string(val)) t.Logf("Change: %s -> %s", key, string(val))
require.Equal(t, expectedVal, string(val)) require.Equal(t, expectedVal, string(val))
} }
......
...@@ -87,7 +87,7 @@ func constructTimestamps(t require.TestingT, numRandomTimestamps int) []time.Tim ...@@ -87,7 +87,7 @@ func constructTimestamps(t require.TestingT, numRandomTimestamps int) []time.Tim
require.NoError(t, err) require.NoError(t, err)
for i := 0; i < numRandomTimestamps; i++ { for i := 0; i < numRandomTimestamps; i++ {
curTime = curTime.Add(1 * time.Second) curTime = curTime.Add(1 * time.Second)
for f := rand.Float32(); f < 0.5; f = rng.Float32() { for f := rng.Float32(); f < 0.5; f = rng.Float32() {
curTime = curTime.Add(-900 * time.Millisecond) curTime = curTime.Add(-900 * time.Millisecond)
} }
res = append(res, curTime) res = append(res, curTime)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment