From 939b2b6d93a7798f427b78fbc3ab061094f30f55 Mon Sep 17 00:00:00 2001 From: Nathaniel Caza Date: Wed, 27 Nov 2019 10:28:37 -0600 Subject: [PATCH] ensure Get() with no ID returns unique values --- smoketest/harness/datagen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/smoketest/harness/datagen.go b/smoketest/harness/datagen.go index c4e8bd2b2f..1bea707c53 100644 --- a/smoketest/harness/datagen.go +++ b/smoketest/harness/datagen.go @@ -64,13 +64,13 @@ func (d *DataGen) Get(id string) string { func (d *DataGen) GetWithArg(arg, id string) string { d.mx.Lock() defer d.mx.Unlock() - if id == "" { - return d.g.Generate(arg) - } key := dataGenKey{arg: arg, id: id} val := dataGenKey{arg: arg, id: ""} var ok bool - val.id, ok = d.data[key] + if id != "" { + // only return previous value if given an ID + val.id, ok = d.data[key] + } if !ok { val.id = d.g.Generate(arg) for d.uniq[val] {