| 59 | ) |
| 60 | |
| 61 | func testSetup() { |
| 62 | stringGroup = NewGroup(stringGroupName, cacheSize, GetterFunc(func(_ context.Context, key string, dest Sink) error { |
| 63 | if key == fromChan { |
| 64 | key = <-stringc |
| 65 | } |
| 66 | cacheFills.Add(1) |
| 67 | return dest.SetString("ECHO:" + key) |
| 68 | })) |
| 69 | |
| 70 | protoGroup = NewGroup(protoGroupName, cacheSize, GetterFunc(func(_ context.Context, key string, dest Sink) error { |
| 71 | if key == fromChan { |
| 72 | key = <-stringc |
| 73 | } |
| 74 | cacheFills.Add(1) |
| 75 | return dest.SetProto(&testpb.TestMessage{ |
| 76 | Name: proto.String("ECHO:" + key), |
| 77 | City: proto.String("SOME-CITY"), |
| 78 | }) |
| 79 | })) |
| 80 | } |
| 81 | |
| 82 | // TestGetDupSuppressString tests that a Getter's Get method is only called once with two |
| 83 | // outstanding callers. This is the string variant. |