Added a CHANGELOG file

This commit is contained in:
Derrick J. Wippler 2019-05-30 17:14:47 -05:00
parent f352930de5
commit 9a873a72e5
2 changed files with 31 additions and 4 deletions

23
CHANGELOG Normal file
View File

@ -0,0 +1,23 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0] - 2019-05-30
### Changes
* Now using golang standard `context.Context` instead of groupcache.Context.
* http requests now respect `context.Context` done.
## [1.3.0] - 2019-05-23
### Added
* Added `Remove()` method to `Group` to purge a key from the group.
## [1.1.0] - 2019-04-10
### Added
* Sinks can now accept an expire time
* Changed import path to mailgun/groupcache
## [hash 5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b] - 2019-01-29
### Changes
* Initial import from https://github.com/golang/groupcache

View File

@ -100,11 +100,15 @@ func TestHTTPPool(t *testing.T) {
getter := GetterFunc(func(ctx context.Context, key string, dest Sink) error {
return errors.New("parent getter called; something's wrong")
})
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
g := NewGroup("httpPoolTest", 1<<20, getter)
for _, key := range testKeys(nGets) {
var value string
if err := g.Get(nil, key, StringSink(&value)); err != nil {
if err := g.Get(ctx, key, StringSink(&value)); err != nil {
t.Fatal(err)
}
if suffix := ":" + key; !strings.HasSuffix(value, suffix) {
@ -123,7 +127,7 @@ func TestHTTPPool(t *testing.T) {
// Multiple gets on the same key
for i := 0; i < 2; i++ {
if err := g.Get(nil, key, StringSink(&value)); err != nil {
if err := g.Get(ctx, key, StringSink(&value)); err != nil {
t.Fatal(err)
}
}
@ -134,12 +138,12 @@ func TestHTTPPool(t *testing.T) {
}
// Remove the key from the cache and we should see another server hit
if err := g.Remove(nil, key); err != nil {
if err := g.Remove(ctx, key); err != nil {
t.Fatal(err)
}
// Get the key again
if err := g.Get(nil, key, StringSink(&value)); err != nil {
if err := g.Get(ctx, key, StringSink(&value)); err != nil {
t.Fatal(err)
}