fixed tests

This commit is contained in:
Yuce Tekol 2017-11-14 20:41:00 +03:00
parent 921c1dd23f
commit 8fdaea5777
No known key found for this signature in database
GPG key ID: CB59E46D2FB90573
2 changed files with 9 additions and 9 deletions

View file

@ -1587,7 +1587,7 @@ func TestHandler_CreateInput(t *testing.T) {
}
inputBody := []byte(`
[{
"columnID": 1,
"id": 1,
"cabType": "yellow",
"distanceMiles": 8,
"withPet": true,
@ -1668,14 +1668,14 @@ func TestInput_JSON(t *testing.T) {
err string
}{
{json: `[{
"columnID": 1,
"id": 1,
"cabType": "yellow",
"distanceMiles": 8,
"nofield": true
}]`,
err: "field not found: nofield"},
{json: `[{
"columnID": "abc",
"id": "abc",
"cabType": "yellow",
"distanceMiles": 8,
"withPet": true
@ -1688,21 +1688,21 @@ func TestInput_JSON(t *testing.T) {
}]`,
err: "primary key does not exist"},
{json: `[{
"columnID": 1,
"id": 1,
"cabType": "yellow",
"distanceMiles": 8,
"withPet": true
}`,
err: "unexpected EOF"},
{json: `[{
"columnID": 1,
"id": 1,
"cabType": "yellow",
"distanceMiles": 8,
"noFrame": 1
}]`,
err: "Frame not found: foo"},
{json: `[{
"columnID": 1,
"id": 1,
"cabType": "yellow",
"distanceMiles": 8,
"time_value": 12345

View file

@ -309,14 +309,14 @@ func TestIndex_CreateInputDefinition(t *testing.T) {
// Create Input Definition.
frames := internal.Frame{Name: "f", Meta: &internal.FrameMeta{RowLabel: "row"}}
action := internal.InputDefinitionAction{Frame: "f", ValueDestination: "mapping", ValueMap: map[string]uint64{"Green": 1}}
fields := internal.InputDefinitionField{PrimaryKey: true, InputDefinitionActions: []*internal.InputDefinitionAction{&action}}
def := internal.InputDefinition{Name: "test", Frames: []*internal.Frame{&frames}, Fields: []*internal.InputDefinitionField{&fields}}
field := internal.InputDefinitionField{Name: "id", PrimaryKey: true, InputDefinitionActions: []*internal.InputDefinitionAction{&action}}
def := internal.InputDefinition{Name: "test", Frames: []*internal.Frame{&frames}, Fields: []*internal.InputDefinitionField{&field}}
inputDef, err := index.CreateInputDefinition(&def)
if err != nil {
t.Fatal(err)
} else if inputDef.Frames()[0].Name != frames.Name {
t.Fatalf("unexpected input definition frames %v", inputDef.Frames())
} else if inputDef.Fields()[0].Name != pilosa.DefaultColumnLabel {
} else if inputDef.Fields()[0].Name != field.Name {
t.Fatalf("unexpected input definition actions %v", inputDef.Fields())
}
}