Example #1
0
func createApp(conn *db.Storage, name, state string) {
	a := app.App{
		Name:  name,
		Units: []app.Unit{{State: state}},
	}
	err := conn.Apps().Insert(&a)
	if err != nil {
		panic(err)
	}
}
Example #2
0
func createTestApp(conn *db.Storage, name, framework string, teams []string, units []app.Unit) (app.App, error) {
	a := app.App{
		Name:      name,
		Framework: framework,
		Teams:     teams,
		Units:     units,
	}
	err := conn.Apps().Insert(&a)
	return a, err
}
Example #3
0
func getFakeApps(conn *db.Storage) ([]app.App, []string) {
	apps := make([]app.App, 20)
	names := make([]string, len(apps))
	for i := range apps {
		name := fmt.Sprintf("app%d", i+1)
		names[i] = name
		apps[i] = app.App{
			Name:     name,
			Platform: "python",
		}
		err := conn.Apps().Insert(apps[i])
		if err != nil {
			panic(err)
		}
	}
	return apps, names
}
Example #4
0
func getApp(conn *db.Storage, c *gocheck.C) *app.App {
	a := &app.App{Name: "umaappqq"}
	err := conn.Apps().Insert(&a)
	c.Assert(err, gocheck.IsNil)
	return a
}
Example #5
0
func destroyApps(conn *db.Storage) {
	allApps := append(pendingApps, runningApps...)
	conn.Apps().Remove(bson.M{"name": bson.M{"$in": allApps}})
}