Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.

Commit 2cae41c

Browse files
authored
Merge pull request #1260 from lavalamp/ff4
fix silly test bug
2 parents 9060171 + 45b01c8 commit 2cae41c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

mungegithub/mungers/flakesync/cache.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,13 @@ func (f Flakes) Less(i, j int) bool {
198198
// Flakes lists all the current flakes, sorted.
199199
func (c *Cache) Flakes() Flakes {
200200
flakes := Flakes{}
201-
c.lock.Lock()
202-
defer c.lock.Unlock()
203-
for _, f := range c.flakeQueue {
204-
flakes = append(flakes, *f)
205-
}
201+
func() {
202+
c.lock.Lock()
203+
defer c.lock.Unlock()
204+
for _, f := range c.flakeQueue {
205+
flakes = append(flakes, *f)
206+
}
207+
}()
206208
sort.Sort(flakes)
207209
return flakes
208210
}

mungegithub/mungers/flakesync/cache_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ func TestBasic(t *testing.T) {
4343
if !reflect.DeepEqual(r1, r2) {
4444
t.Errorf("expected to match: %#v, %#v", r1, r2)
4545
}
46-
i := 6
47-
for len(c.Flakes()) == 0 {
46+
for i := 0; len(c.Flakes()) == 0; i++ {
4847
c.Get("foo", Number(i))
4948
}
5049
}

0 commit comments

Comments
 (0)