start writing tests for the query engine.
parent
5de35550e6
commit
3118312a21
|
@ -0,0 +1,39 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"coordinator"
|
||||
. "launchpad.net/gocheck"
|
||||
"parser"
|
||||
"protocol"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Hook up gocheck into the gotest runner.
|
||||
func Test(t *testing.T) {
|
||||
TestingT(t)
|
||||
}
|
||||
|
||||
type EngineSuite struct{}
|
||||
|
||||
var _ = Suite(&EngineSuite{})
|
||||
|
||||
type MockCoordinator struct {
|
||||
}
|
||||
|
||||
func (self *MockCoordinator) DistributeQuery(query *parser.Query, yield func(*protocol.Series) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *MockCoordinator) WriteSeriesData(series *protocol.Series) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createMockCoordinator() coordinator.Coordinator {
|
||||
return &MockCoordinator{}
|
||||
}
|
||||
|
||||
func (self *EngineSuite) TestBasicQuery(c *C) {
|
||||
engine, err := NewQueryEngine(createMockCoordinator())
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(engine, NotNil)
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package engine
|
||||
|
||||
import (
|
||||
"coordinator"
|
||||
"parser"
|
||||
"protocol"
|
||||
)
|
||||
|
||||
type EngineI interface {
|
||||
RunQuery(query *parser.Query, yield func(*protocol.Series) error) error
|
||||
}
|
||||
|
||||
func NewQueryEngine(c coordinator.Coordinator) (EngineI, error) {
|
||||
return nil, nil
|
||||
}
|
Loading…
Reference in New Issue