mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
#413 add tests and remove redundant word
This commit is contained in:
parent
e20b9075e2
commit
b635bdf970
4 changed files with 15 additions and 7 deletions
|
|
@ -394,8 +394,8 @@ func (c *Client) ExportCSV(ctx context.Context, index, frame, view string, slice
|
|||
return ErrIndexRequired
|
||||
} else if frame == "" {
|
||||
return ErrFrameRequired
|
||||
} else if view == "" {
|
||||
view = ViewStandard
|
||||
} else if view != ViewInverse || view != ViewStandard {
|
||||
return ErrInvalidView
|
||||
}
|
||||
|
||||
// Retrieve a list of nodes that own the slice.
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ The file does not contain any headers.
|
|||
flags := exportCmd.Flags()
|
||||
|
||||
flags.StringVarP(&Exporter.Host, "host", "", "localhost:10101", "host:port of Pilosa.")
|
||||
flags.StringVarP(&Exporter.Index, "index", "i", "", "Pilosa index to export into.")
|
||||
flags.StringVarP(&Exporter.Frame, "frame", "f", "", "Frame to export into.")
|
||||
flags.StringVarP(&Exporter.View, "view", "v", "", "View to export into - default standard")
|
||||
flags.StringVarP(&Exporter.Index, "index", "i", "", "Pilosa index to export")
|
||||
flags.StringVarP(&Exporter.Frame, "frame", "f", "", "Frame to export")
|
||||
flags.StringVarP(&Exporter.View, "view", "v", "standard", "View to export - default standard")
|
||||
flags.StringVarP(&Exporter.Path, "output-file", "o", "", "File to write export to - default stdout")
|
||||
|
||||
return exportCmd
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ frame = "f1"
|
|||
v.Check(cmd.Exporter.Host, "localhost:12345")
|
||||
v.Check(cmd.Exporter.Index, "myindex")
|
||||
v.Check(cmd.Exporter.Frame, "f1")
|
||||
v.Check(cmd.Exporter.View, "standard")
|
||||
v.Check(cmd.Exporter.Path, "/somefile")
|
||||
return v.Error()
|
||||
},
|
||||
|
|
@ -51,3 +52,10 @@ frame = "f1"
|
|||
}
|
||||
executeDry(t, tests)
|
||||
}
|
||||
|
||||
func TestExportInvalidView(t *testing.T) {
|
||||
output, err := ExecNewRootCommand(t, "export", "-i", "foo", "-f", "bar", "-v", "test")
|
||||
if !strings.Contains(err.Error(), "invalid view") {
|
||||
t.Fatalf("Command 'export' with invalid view should error but: err: '%v', output: '%v'", err, output)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ func (cmd *ExportCommand) Run(ctx context.Context) error {
|
|||
return pilosa.ErrIndexRequired
|
||||
} else if cmd.Frame == "" {
|
||||
return pilosa.ErrFrameRequired
|
||||
} else if cmd.View == "" {
|
||||
cmd.View = pilosa.ViewStandard
|
||||
} else if cmd.View != pilosa.ViewStandard || cmd.View != pilosa.ViewInverse {
|
||||
return pilosa.ErrInvalidView
|
||||
}
|
||||
|
||||
// Use output file, if specified.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue