featurebase/hold/hold_test.go
Ben Johnson b06ecf3320 Update import path
This commit updates the import path from:

```
pilosa/*
```

to:

```
github.com/umbel/pilosa/*
```

This follows standard Go convention and makes the project "go gettable".

The README was also updated to reflect the changes.
2015-08-05 22:50:38 -06:00

31 lines
633 B
Go

package hold
import (
"testing"
"time"
. "github.com/smartystreets/goconvey/convey"
"github.com/umbel/pilosa/util"
)
func TestHoldChan(t *testing.T) {
Hold := Holder{make(map[util.GUID]holdchan), make(chan gethold), make(chan delhold)}
go Hold.Run()
Convey("set then get", t, func() {
id := util.RandomUUID()
Hold.Set(&id, "derp", 10)
derp, _ := Hold.Get(&id, 10)
So(derp, ShouldEqual, "derp")
})
Convey("get then set", t, func() {
id := util.RandomUUID()
go func() {
Hold.Set(&id, "derpsy", 10)
}()
time.Sleep(time.Second / 10)
derp, _ := Hold.Get(&id, 10)
So(derp, ShouldEqual, "derpsy")
})
}