From 9a873a72e55944e6451eeef1c502933160dfa479 Mon Sep 17 00:00:00 2001 From: "Derrick J. Wippler" Date: Thu, 30 May 2019 17:14:47 -0500 Subject: [PATCH] Added a CHANGELOG file --- CHANGELOG | 23 +++++++++++++++++++++++ http_test.go | 12 ++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..6ebe50f --- /dev/null +++ b/CHANGELOG @@ -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 diff --git a/http_test.go b/http_test.go index c2764a3..d3b40d4 100644 --- a/http_test.go +++ b/http_test.go @@ -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) }