Skip to content
Snippets Groups Projects
Commit dc407870 authored by Christian Pointner's avatar Christian Pointner
Browse files

fix store testcases

parent ac7a27fc
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,26 @@ func openStoreAndImporter(conf *Config) (st *store.Store, im *importer.Importer,
return
}
func cmdTest(c *cli.Context) error {
conf, err := ReadConfig(c.GlobalString("config"))
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
st, err := store.NewStore(conf.Store)
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
groups, err := st.ListGroups()
if err != nil {
return cli.NewExitError(err.Error(), 1)
}
infoLog.Printf("groups: %v", groups)
return cli.NewExitError("", 0)
}
func cmdRun(c *cli.Context) error {
infoLog.Println("starting...")
......@@ -160,6 +180,11 @@ func main() {
Usage: "initialize the store",
Action: cmdInit,
},
{
Name: "test",
Usage: "run some tests",
Action: cmdTest,
},
{
Name: "run",
Usage: "run the daemon",
......
......@@ -69,7 +69,7 @@ func TestMain(m *testing.M) {
func TestOpen(t *testing.T) {
// base-path is non-existing directory
cfg := &Config{}
cfg := Config{}
cfg.BasePath = "/nonexistend/"
cfg.DB.Type = testDBType
cfg.DB.Connection = testDBConnection
......@@ -108,7 +108,7 @@ func TestOpen(t *testing.T) {
}
func TestMigrations(t *testing.T) {
cfg := &Config{}
cfg := Config{}
cfg.BasePath = testBasePath
cfg.DB.Type = testDBType
cfg.DB.Connection = testDBConnection
......@@ -169,7 +169,7 @@ func TestMigrations(t *testing.T) {
//
func TestGroups(t *testing.T) {
cfg := &Config{}
cfg := Config{}
cfg.BasePath = testBasePath
cfg.DB.Type = testDBType
cfg.DB.Connection = testDBConnection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment