예제 #1
0
func TestListKnownActions(t *testing.T) {
	do := definitions.NowDo()
	do.Quiet = true
	tests.IfExit(list.ListActions(do))
	k := strings.Split(do.Result, "\n") // tests output formatting.

	ver.ACTION_DEFINITIONS = append(ver.ACTION_DEFINITIONS, "do_not_use.toml")

	if len(k) != len(ver.ACTION_DEFINITIONS) {
		tests.IfExit(fmt.Errorf("Did not find correct number of action definitions files, Expected %v, found %v.\n", len(ver.ACTION_DEFINITIONS), len(k)))
	}

	actDefs := make(map[string]bool)

	for _, act := range ver.ACTION_DEFINITIONS {
		actDef := strings.Split(act, ".")
		actDefs[actDef[0]] = true
	}

	i := 0
	for _, actFile := range k {
		if actDefs[actFile] == true {
			i++
		}
	}

	if i != len(ver.ACTION_DEFINITIONS) {
		tests.IfExit(fmt.Errorf("Could not find all the expected action definition files.\n"))
	}
}
예제 #2
0
func TestMain(m *testing.M) {
	log.SetFormatter(logger.ErisFormatter{})

	log.SetLevel(log.ErrorLevel)
	// log.SetLevel(log.InfoLevel)
	// log.SetLevel(log.DebugLevel)
	tests.IfExit(testsInit())

	exitCode := m.Run()
	tests.IfExit(tests.TestsTearDown())
	os.Exit(exitCode)
}
예제 #3
0
func TestMain(m *testing.M) {
	log.SetFormatter(logger.ErisFormatter{})

	log.SetLevel(log.ErrorLevel)
	// log.SetLevel(log.InfoLevel)
	// log.SetLevel(log.DebugLevel)

	// Prevent CLI from starting IPFS.
	os.Setenv("ERIS_SKIP_ENSURE", "true")

	tests.IfExit(testsInit())
	exitCode := m.Run()
	tests.IfExit(tests.TestsTearDown())
	os.Exit(exitCode)
}
예제 #4
0
func TestMain(m *testing.M) {
	runtime.GOMAXPROCS(1)
	log.SetFormatter(logger.ErisFormatter{})

	log.SetLevel(log.ErrorLevel)
	// log.SetLevel(log.InfoLevel)
	// log.SetLevel(log.DebugLevel)

	tests.IfExit(tests.TestsInit("chain"))
	mockChainDefinitionFile(chainName)

	m.Run()

	tests.IfExit(tests.TestsTearDown())
}
예제 #5
0
//returns an addr for tests
func testsGenAKey() string {
	addr := new(bytes.Buffer)
	config.GlobalConfig.Writer = addr
	doGen := def.NowDo()
	tests.IfExit(GenerateKey(doGen))

	addrBytes := addr.Bytes()
	address := util.TrimString(string(addrBytes))
	return address
}
예제 #6
0
func testListKeys(typ string) []string {
	do := def.NowDo()

	if typ == "container" {
		do.Container = true
		do.Host = false
	} else if typ == "host" {
		do.Container = false
		do.Host = true
	}

	if err := ListKeys(do); err != nil {
		tests.IfExit(err)
	}

	res := strings.Split(do.Result, ",")

	return res
}