コード例 #1
0
ファイル: chains_test.go プロジェクト: jeffanthony/eris-cli
func TestRmChain(t *testing.T) {
	testStartChain(t, chainName)

	do := def.NowDo()
	do.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	logger.Infof("Removing keys (from tests) =>\n%s\n", do.Name)
	if e := services.KillService(do); e != nil {
		fatal(t, e)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chainName, false, false
	logger.Infof("Stopping chain (from tests) =>\t%s\n", do.Name)
	if e := KillChain(do); e != nil {
		fatal(t, e)
	}
	testExistAndRun(t, chainName, true, false)

	do = def.NowDo()
	do.Name = chainName
	do.RmD = true
	logger.Infof("Removing chain (from tests) =>\n%s\n", do.Name)
	if e := RmChain(do); e != nil {
		fatal(t, e)
	}

	testExistAndRun(t, chainName, false, false)
}
コード例 #2
0
ファイル: chains_test.go プロジェクト: mxjxn/eris-cli
func TestRmChain(t *testing.T) {
	testStartChain(t, chainName)

	do := def.NowDo()
	do.Operations.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	log.WithField("=>", do.Name).Info("Removing keys (from tests)")
	if e := services.KillService(do); e != nil {
		tests.IfExit(e)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chainName, false, false
	log.WithField("=>", do.Name).Info("Stopping chain (from tests)")
	if e := KillChain(do); e != nil {
		tests.IfExit(e)
	}
	testExistAndRun(t, chainName, true, false)

	do = def.NowDo()
	do.Name = chainName
	do.RmD = true
	log.WithField("=>", do.Name).Info("Removing chain (from tests)")
	if e := RmChain(do); e != nil {
		tests.IfExit(e)
	}

	testExistAndRun(t, chainName, false, false)
}
コード例 #3
0
ファイル: chains_test.go プロジェクト: antonylewis/eris-cli
func TestRmChain(t *testing.T) {
	start(t, chainName)

	do := def.NowDo()
	do.Operations.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	if err := services.KillService(do); err != nil {
		t.Fatalf("expected service to be stopped, got %v", err)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chainName, false, false
	log.WithField("=>", do.Name).Info("Stopping chain (from tests)")
	if err := KillChain(do); err != nil {
		t.Fatalf("expected chain to be stopped, got %v", err)
	}
	if n := util.HowManyContainersExisting(chainName, def.TypeChain); n != 1 {
		t.Fatalf("expecting 1 chain containers, got %v", n)
	}

	do = def.NowDo()
	do.Name = chainName
	do.RmD = true
	log.WithField("=>", do.Name).Info("Removing chain (from tests)")
	if err := RmChain(do); err != nil {
		t.Fatalf("expected chain to be removed, got %v", err)
	}
	if n := util.HowManyContainersExisting(chainName, def.TypeChain); n != 0 {
		t.Fatalf("expecting 0 chain containers, got %v", n)
	}
}
コード例 #4
0
ファイル: chains_test.go プロジェクト: jeffanthony/eris-cli
func killService(name string) {
	do := def.NowDo()
	do.Name = name
	do.Args = []string{name}
	do.Rm, do.RmD, do.Force = true, true, true
	if e := services.KillService(do); e != nil {
		logger.Errorln(e)
		fatal(nil, e)
	}
}
コード例 #5
0
ファイル: files_test.go プロジェクト: alexandrev/eris-cli
func testKillIPFS(t *testing.T) {
	serviceName := "ipfs"
	logger.Debugf("Stopping serv (via tests) =>\t%s\n", serviceName)

	do := definitions.NowDo()
	do.Name = serviceName
	do.Operations.Args = []string{serviceName}
	do.Rm = true
	do.RmD = true
	if e := services.KillService(do); e != nil {
		t.Fatal(e)
	}
}
コード例 #6
0
ファイル: chains_test.go プロジェクト: antonylewis/eris-cli
func kill(t *testing.T, chain string) {
	do := def.NowDo()
	do.Operations.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	if err := services.KillService(do); err != nil {
		t.Fatalf("killing keys service failed: %v", err)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chain, true, true
	if err := KillChain(do); err != nil {
		t.Fatalf("killing chain failed: %v", err)
	}
}
コード例 #7
0
ファイル: keys_test.go プロジェクト: alexandrev/eris-cli
func testKillService(t *testing.T, serviceName string, wipe bool) {
	logger.Debugf("Stopping serv (via tests) =>\t%s\n", serviceName)

	do := def.NowDo()
	do.Name = serviceName
	do.Operations.Args = []string{serviceName}
	if wipe {
		do.Rm = true
		do.RmD = true
	}
	e := srv.KillService(do)
	if e != nil {
		logger.Errorln(e)
		fatal(t, e)
	}
	testExistAndRun(t, serviceName, 1, !wipe, false)
	testNumbersExistAndRun(t, serviceName, 0, 0)
}
コード例 #8
0
ファイル: keys_test.go プロジェクト: mxjxn/eris-cli
func testKillService(t *testing.T, serviceName string, wipe bool) {
	log.WithField("=>", serviceName).Debug("Stopping service (from tests)")

	do := def.NowDo()
	do.Name = serviceName
	do.Operations.Args = []string{serviceName}
	if wipe {
		do.Rm = true
		do.RmD = true
	}
	e := srv.KillService(do)
	if e != nil {
		log.Error(e)
		fatal(t, e)
	}
	testExistAndRun(t, serviceName, 1, !wipe, false)
	testNumbersExistAndRun(t, serviceName, 0, 0)
}
コード例 #9
0
ファイル: chains_test.go プロジェクト: jeffanthony/eris-cli
func testKillChain(t *testing.T, chain string) {
	// log.SetLoggers(2, os.Stdout, os.Stderr)
	testExistAndRun(t, chain, true, true)

	do := def.NowDo()
	do.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	logger.Infof("Killing keys (from tests) =>\n%s\n", do.Name)
	if e := services.KillService(do); e != nil {
		fatal(t, e)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chain, true, true
	logger.Infof("Stopping chain (from tests) =>\t%s\n", do.Name)
	if e := KillChain(do); e != nil {
		fatal(t, e)
	}
	testExistAndRun(t, chain, false, false)
}
コード例 #10
0
ファイル: chains_test.go プロジェクト: mxjxn/eris-cli
func testKillChain(t *testing.T, chain string) {
	// log.SetLoggers(2, os.Stdout, os.Stderr)
	testExistAndRun(t, chain, true, true)

	do := def.NowDo()
	do.Operations.Args, do.Rm, do.RmD = []string{"keys"}, true, true
	log.WithField("=>", do.Name).Info("Stopping service (from tests)")
	if e := services.KillService(do); e != nil {
		tests.IfExit(e)
	}

	do = def.NowDo()
	do.Name, do.Rm, do.RmD = chain, true, true
	log.WithField("=>", do.Name).Info("Stopping chain (from tests)")
	if e := KillChain(do); e != nil {
		tests.IfExit(e)
	}
	testExistAndRun(t, chain, false, false)
}
コード例 #11
0
ファイル: chains_test.go プロジェクト: slowtokyo/eris-cli
func TestKillChain(t *testing.T) {
	// log.SetLoggers(2, os.Stdout, os.Stderr)
	testExistAndRun(t, chainName, true, true)

	do := def.NowDo()
	do.Args = []string{"keys"}
	if os.Getenv("TEST_IN_CIRCLE") != "true" {
		do.Rm = true
		do.RmD = true
	}
	logger.Infof("Removing keys (from tests) =>\n%s\n", do.Name)
	e := services.KillService(do)
	if e != nil {
		logger.Errorln(e)
		t.Fail()
	}

	do = def.NowDo()
	do.Name = chainName
	if os.Getenv("TEST_IN_CIRCLE") != "true" {
		do.Rm = true
		do.RmD = true
	}
	logger.Infof("Stopping chain (from tests) =>\t%s\n", do.Name)
	e = KillChain(do)
	if e != nil {
		logger.Errorln(e)
		t.Fail()
	}
	if os.Getenv("TEST_IN_CIRCLE") != "true" {
		testExistAndRun(t, chainName, false, false)
	} else {
		testExistAndRun(t, chainName, true, false)
	}
	// log.SetLoggers(0, os.Stdout, os.Stderr)
}
コード例 #12
0
ファイル: services.go プロジェクト: kustomzone/eris-cli
func KillService(cmd *cobra.Command, args []string) {
	IfExit(ArgCheck(1, "ge", cmd, args))
	do.Args = args
	IfExit(srv.KillService(do))
}