start writing tests for the query engine.

pull/17/head
John Shahid 2013-10-09 12:09:16 -04:00
parent 5de35550e6
commit 3118312a21
2 changed files with 54 additions and 0 deletions

39
src/engine/engine_test.go Normal file
View File

@ -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)
}

15
src/engine/interface.go Normal file
View File

@ -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
}