Browse Source

godep: update clockwork dependency

Jonathan Boulle 11 years ago
parent
commit
e0801360d3

+ 1 - 1
Godeps/Godeps.json

@@ -16,7 +16,7 @@
 		},
 		},
 		{
 		{
 			"ImportPath": "github.com/jonboulle/clockwork",
 			"ImportPath": "github.com/jonboulle/clockwork",
-			"Rev": "46fde511e4fda2f685792de1700f20e1c45bfe41"
+			"Rev": "72f9bd7c4e0c2a40055ab3d0f09654f730cce982"
 		},
 		},
 		{
 		{
 			"ImportPath": "github.com/stretchr/testify/assert",
 			"ImportPath": "github.com/stretchr/testify/assert",

+ 2 - 2
Godeps/_workspace/src/github.com/jonboulle/clockwork/README.md

@@ -39,8 +39,8 @@ func TestMyFunc(t *testing.T) {
 
 
 	assert_state()
 	assert_state()
 
 
-	// Tick the FakeClock forward in time
-	c.Tick(3)
+	// Advance the FakeClock forward in time
+	c.Advance(3)
 
 
 	assert_state()
 	assert_state()
 }
 }

+ 7 - 7
Godeps/_workspace/src/github.com/jonboulle/clockwork/clockwork.go

@@ -14,12 +14,12 @@ type Clock interface {
 }
 }
 
 
 // FakeClock provides an interface for a clock which can be
 // FakeClock provides an interface for a clock which can be
-// manually ticked through time
+// manually advanced through time
 type FakeClock interface {
 type FakeClock interface {
 	Clock
 	Clock
-	// Tick advances the FakeClock to a new point in time, ensuring any existing
+	// Advance advances the FakeClock to a new point in time, ensuring any existing
 	// sleepers are notified appropriately before returning
 	// sleepers are notified appropriately before returning
-	Tick(d time.Duration)
+	Advance(d time.Duration)
 	// BlockUntil will block until the FakeClock has the given number of
 	// BlockUntil will block until the FakeClock has the given number of
 	// sleepers (callers of Sleep or After)
 	// sleepers (callers of Sleep or After)
 	BlockUntil(n int)
 	BlockUntil(n int)
@@ -32,7 +32,7 @@ func NewRealClock() Clock {
 }
 }
 
 
 // NewFakeClock returns a FakeClock implementation which can be
 // NewFakeClock returns a FakeClock implementation which can be
-// manually ticked through time for testing.
+// manually advanced through time for testing.
 func NewFakeClock() FakeClock {
 func NewFakeClock() FakeClock {
 	return &fakeClock{
 	return &fakeClock{
 		l: sync.RWMutex{},
 		l: sync.RWMutex{},
@@ -122,10 +122,11 @@ func (fc *fakeClock) Now() time.Time {
 	return fc.time
 	return fc.time
 }
 }
 
 
-// Tick advances fakeClock to a new point in time, ensuring channels from any
+// Advance advances fakeClock to a new point in time, ensuring channels from any
 // previous invocations of After are notified appropriately before returning
 // previous invocations of After are notified appropriately before returning
-func (fc *fakeClock) Tick(d time.Duration) {
+func (fc *fakeClock) Advance(d time.Duration) {
 	fc.l.Lock()
 	fc.l.Lock()
+	defer fc.l.Unlock()
 	end := fc.time.Add(d)
 	end := fc.time.Add(d)
 	var newSleepers []*sleeper
 	var newSleepers []*sleeper
 	for _, s := range fc.sleepers {
 	for _, s := range fc.sleepers {
@@ -138,7 +139,6 @@ func (fc *fakeClock) Tick(d time.Duration) {
 	fc.sleepers = newSleepers
 	fc.sleepers = newSleepers
 	fc.blockers = notifyBlockers(fc.blockers, len(fc.sleepers))
 	fc.blockers = notifyBlockers(fc.blockers, len(fc.sleepers))
 	fc.time = end
 	fc.time = end
-	fc.l.Unlock()
 }
 }
 
 
 // BlockUntil will block until the fakeClock has the given number of sleepers
 // BlockUntil will block until the fakeClock has the given number of sleepers

+ 5 - 5
Godeps/_workspace/src/github.com/jonboulle/clockwork/clockwork_test.go

@@ -18,7 +18,7 @@ func TestFakeClockAfter(t *testing.T) {
 	two := fc.After(2)
 	two := fc.After(2)
 	six := fc.After(6)
 	six := fc.After(6)
 	ten := fc.After(10)
 	ten := fc.After(10)
-	fc.Tick(1)
+	fc.Advance(1)
 	select {
 	select {
 	case <-one:
 	case <-one:
 	default:
 	default:
@@ -33,7 +33,7 @@ func TestFakeClockAfter(t *testing.T) {
 		t.Errorf("ten returned prematurely!")
 		t.Errorf("ten returned prematurely!")
 	default:
 	default:
 	}
 	}
-	fc.Tick(1)
+	fc.Advance(1)
 	select {
 	select {
 	case <-two:
 	case <-two:
 	default:
 	default:
@@ -46,7 +46,7 @@ func TestFakeClockAfter(t *testing.T) {
 		t.Errorf("ten returned prematurely!")
 		t.Errorf("ten returned prematurely!")
 	default:
 	default:
 	}
 	}
-	fc.Tick(1)
+	fc.Advance(1)
 	select {
 	select {
 	case <-six:
 	case <-six:
 		t.Errorf("six returned prematurely!")
 		t.Errorf("six returned prematurely!")
@@ -54,7 +54,7 @@ func TestFakeClockAfter(t *testing.T) {
 		t.Errorf("ten returned prematurely!")
 		t.Errorf("ten returned prematurely!")
 	default:
 	default:
 	}
 	}
-	fc.Tick(3)
+	fc.Advance(3)
 	select {
 	select {
 	case <-six:
 	case <-six:
 	default:
 	default:
@@ -65,7 +65,7 @@ func TestFakeClockAfter(t *testing.T) {
 		t.Errorf("ten returned prematurely!")
 		t.Errorf("ten returned prematurely!")
 	default:
 	default:
 	}
 	}
-	fc.Tick(100)
+	fc.Advance(100)
 	select {
 	select {
 	case <-ten:
 	case <-ten:
 	default:
 	default:

+ 2 - 2
Godeps/_workspace/src/github.com/jonboulle/clockwork/example_test.go

@@ -38,8 +38,8 @@ func TestMyFunc(t *testing.T) {
 	// Assert the initial state
 	// Assert the initial state
 	assert_state(t, i, 0)
 	assert_state(t, i, 0)
 
 
-	// Now tick the clock forward in time
-	c.Tick(1 * time.Hour)
+	// Now advance the clock forward in time
+	c.Advance(1 * time.Hour)
 
 
 	// Wait until the function completes
 	// Wait until the function completes
 	wg.Wait()
 	wg.Wait()

+ 1 - 1
discovery/discovery.go

@@ -13,8 +13,8 @@ import (
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
-	"github.com/coreos/etcd/client"
 	"github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork"
 	"github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork"
+	"github.com/coreos/etcd/client"
 )
 )
 
 
 var (
 var (

+ 4 - 4
discovery/discovery_test.go

@@ -12,8 +12,8 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
-	"github.com/coreos/etcd/client"
 	"github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork"
 	"github.com/coreos/etcd/Godeps/_workspace/src/github.com/jonboulle/clockwork"
+	"github.com/coreos/etcd/client"
 )
 )
 
 
 func TestProxyFuncFromEnvUnset(t *testing.T) {
 func TestProxyFuncFromEnvUnset(t *testing.T) {
@@ -175,7 +175,7 @@ func TestCheckCluster(t *testing.T) {
 			go func() {
 			go func() {
 				for i := uint(1); i <= nRetries; i++ {
 				for i := uint(1); i <= nRetries; i++ {
 					fc.BlockUntil(1)
 					fc.BlockUntil(1)
-					fc.Tick(time.Second * (0x1 << i))
+					fc.Advance(time.Second * (0x1 << i))
 				}
 				}
 			}()
 			}()
 			ns, size, err := d.checkCluster()
 			ns, size, err := d.checkCluster()
@@ -263,7 +263,7 @@ func TestWaitNodes(t *testing.T) {
 			go func() {
 			go func() {
 				for i := uint(1); i <= nRetries; i++ {
 				for i := uint(1); i <= nRetries; i++ {
 					fc.BlockUntil(1)
 					fc.BlockUntil(1)
-					fc.Tick(time.Second * (0x1 << i))
+					fc.Advance(time.Second * (0x1 << i))
 				}
 				}
 			}()
 			}()
 			g, err := d.waitNodes(tt.nodes, 3)
 			g, err := d.waitNodes(tt.nodes, 3)
@@ -363,7 +363,7 @@ func TestRetryFailure(t *testing.T) {
 	go func() {
 	go func() {
 		for i := uint(1); i <= nRetries; i++ {
 		for i := uint(1); i <= nRetries; i++ {
 			fc.BlockUntil(1)
 			fc.BlockUntil(1)
-			fc.Tick(time.Second * (0x1 << i))
+			fc.Advance(time.Second * (0x1 << i))
 		}
 		}
 	}()
 	}()
 	if _, _, err := d.checkCluster(); err != ErrTooManyRetries {
 	if _, _, err := d.checkCluster(); err != ErrTooManyRetries {

+ 1 - 1
etcdserver/etcdhttp/http_test.go

@@ -217,7 +217,7 @@ func TestBadParseRequest(t *testing.T) {
 
 
 func TestGoodParseRequest(t *testing.T) {
 func TestGoodParseRequest(t *testing.T) {
 	fc := clockwork.NewFakeClock()
 	fc := clockwork.NewFakeClock()
-	fc.Tick(1111)
+	fc.Advance(1111)
 	tests := []struct {
 	tests := []struct {
 		in *http.Request
 		in *http.Request
 		w  etcdserverpb.Request
 		w  etcdserverpb.Request

+ 1 - 1
store/stats_test.go

@@ -93,7 +93,7 @@ func TestStoreStatsExpireCount(t *testing.T) {
 
 
 	s.Create("/foo", false, "bar", false, fc.Now().Add(500*time.Millisecond))
 	s.Create("/foo", false, "bar", false, fc.Now().Add(500*time.Millisecond))
 	assert.Equal(t, uint64(0), s.Stats.ExpireCount, "")
 	assert.Equal(t, uint64(0), s.Stats.ExpireCount, "")
-	fc.Tick(600 * time.Millisecond)
+	fc.Advance(600 * time.Millisecond)
 	s.DeleteExpiredKeys(fc.Now())
 	s.DeleteExpiredKeys(fc.Now())
 	assert.Equal(t, uint64(1), s.Stats.ExpireCount, "")
 	assert.Equal(t, uint64(1), s.Stats.ExpireCount, "")
 }
 }

+ 6 - 6
store/store_test.go

@@ -323,7 +323,7 @@ func TestStoreUpdateValueTTL(t *testing.T) {
 	e, _ := s.Get("/foo", false, false)
 	e, _ := s.Get("/foo", false, false)
 	assert.Equal(t, *e.Node.Value, "baz", "")
 	assert.Equal(t, *e.Node.Value, "baz", "")
 	assert.Equal(t, e.EtcdIndex, eidx, "")
 	assert.Equal(t, e.EtcdIndex, eidx, "")
-	fc.Tick(600 * time.Millisecond)
+	fc.Advance(600 * time.Millisecond)
 	s.DeleteExpiredKeys(fc.Now())
 	s.DeleteExpiredKeys(fc.Now())
 	e, err = s.Get("/foo", false, false)
 	e, err = s.Get("/foo", false, false)
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
@@ -346,7 +346,7 @@ func TestStoreUpdateDirTTL(t *testing.T) {
 	assert.Equal(t, *e.Node.Value, "baz", "")
 	assert.Equal(t, *e.Node.Value, "baz", "")
 	assert.Equal(t, e.EtcdIndex, eidx, "")
 	assert.Equal(t, e.EtcdIndex, eidx, "")
 
 
-	fc.Tick(600 * time.Millisecond)
+	fc.Advance(600 * time.Millisecond)
 	s.DeleteExpiredKeys(fc.Now())
 	s.DeleteExpiredKeys(fc.Now())
 	e, err = s.Get("/foo/bar", false, false)
 	e, err = s.Get("/foo/bar", false, false)
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
@@ -715,7 +715,7 @@ func TestStoreWatchExpire(t *testing.T) {
 	c := w.EventChan()
 	c := w.EventChan()
 	e := nbselect(c)
 	e := nbselect(c)
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
-	fc.Tick(600 * time.Millisecond)
+	fc.Advance(600 * time.Millisecond)
 	s.DeleteExpiredKeys(fc.Now())
 	s.DeleteExpiredKeys(fc.Now())
 	eidx = 3
 	eidx = 3
 	e = nbselect(c)
 	e = nbselect(c)
@@ -800,7 +800,7 @@ func TestStoreRecoverWithExpiration(t *testing.T) {
 
 
 	s2.Recovery(b)
 	s2.Recovery(b)
 
 
-	fc.Tick(600 * time.Millisecond)
+	fc.Advance(600 * time.Millisecond)
 	s.DeleteExpiredKeys(fc.Now())
 	s.DeleteExpiredKeys(fc.Now())
 
 
 	e, err := s.Get("/foo/x", false, false)
 	e, err := s.Get("/foo/x", false, false)
@@ -904,11 +904,11 @@ func TestStoreWatchExpireWithHiddenKey(t *testing.T) {
 	c := w.EventChan()
 	c := w.EventChan()
 	e := nbselect(c)
 	e := nbselect(c)
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
-	fc.Tick(600 * time.Millisecond)
+	fc.Advance(600 * time.Millisecond)
 	s.DeleteExpiredKeys(fc.Now())
 	s.DeleteExpiredKeys(fc.Now())
 	e = nbselect(c)
 	e = nbselect(c)
 	assert.Nil(t, e, "")
 	assert.Nil(t, e, "")
-	fc.Tick(600 * time.Millisecond)
+	fc.Advance(600 * time.Millisecond)
 	s.DeleteExpiredKeys(fc.Now())
 	s.DeleteExpiredKeys(fc.Now())
 	e = nbselect(c)
 	e = nbselect(c)
 	assert.Equal(t, e.Action, "expire", "")
 	assert.Equal(t, e.Action, "expire", "")