func TestMain(m *testing.M) { var logLevel log.LogLevel logLevel = 0 // logLevel = 1 // logLevel = 3 log.SetLoggers(logLevel, os.Stdout, os.Stderr) if err := testsInit(); err != nil { logger.Errorln(err) os.Exit(1) } exitCode := m.Run() if os.Getenv("TEST_IN_CIRCLE") != "true" { if err := testsTearDown(); err != nil { logger.Errorln(err) log.Flush() os.Exit(1) } } os.Exit(exitCode) }
func testsTearDown() error { DEAD = true killService("keys") testKillChain(nil, chainName) log.Flush() return os.RemoveAll(erisDir) }
func IfExit(err error) { if err != nil { log.Flush() fmt.Println(err) os.Exit(1) } }
func ifExit(err error) { if err != nil { logger.Errorln(err) log.Flush() testsTearDown() os.Exit(1) } }
func fatal(t *testing.T, err error) { if !DEAD { log.Flush() testsTearDown() DEAD = true panic(err) } }
func Exit(err error) { status := 0 if err != nil { log.Flush() fmt.Println(err) status = 1 } os.Exit(status) }
func IfExit(err error) { if err != nil { logger.Errorln(err) if err := TestsTearDown(); err != nil { logger.Errorln(err) } log.Flush() os.Exit(1) } }
ipfs.IpfsHost = config.GlobalConfig.Config.IpfsHost util.DockerConnect(do.Verbose, do.MachineName) dockerVersion, _ := util.DockerClientVersion() marmot := "Come back after you have upgraded and the marmots will be happy to service your blockchain management needs" if dockerVersion < dVerMin { IfExit(fmt.Errorf("Eris requires docker version >= %v\nThe marmots have detected docker version: %v\n%s", dVerMin, dockerVersion, marmot)) } }, PersistentPostRun: func(cmd *cobra.Command, args []string) { err := config.SaveGlobalConfig(config.GlobalConfig.Config) if err != nil { logger.Errorln(err) } log.Flush() }, } func Execute() { InitializeConfig() AddGlobalFlags() AddCommands() ErisCmd.Execute() } // Define the commands func AddCommands() { buildServicesCommand() ErisCmd.AddCommand(Services) buildChainsCommand()