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) } }
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 }
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 }
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 }
func destroyApps(conn *db.Storage) { allApps := append(pendingApps, runningApps...) conn.Apps().Remove(bson.M{"name": bson.M{"$in": allApps}}) }