Make first WebUI random page stick
This commit is contained in:
@@ -40,4 +40,18 @@ var _ = Describe("HashFunc", func() {
|
||||
Expect(sum).To(Equal(hashFunc("1", input)))
|
||||
Expect(sum2).To(Equal(hashFunc("2", input)))
|
||||
})
|
||||
|
||||
It("keeps the same hash for the same id and seed", func() {
|
||||
id := "1"
|
||||
hashFunc := hasher.HashFunc()
|
||||
hasher.SetSeed(id, "original_seed")
|
||||
sum := hashFunc(id, input)
|
||||
Expect(sum).To(Equal(hashFunc(id, input)))
|
||||
|
||||
hasher.Reseed(id)
|
||||
Expect(sum).NotTo(Equal(hashFunc(id, input)))
|
||||
|
||||
hasher.SetSeed(id, "original_seed")
|
||||
Expect(sum).To(Equal(hashFunc(id, input)))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user