コード例 #1
0
ファイル: files_test.go プロジェクト: jumanjiman/eris-cli
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	do := definitions.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	ifExit(ini.Initialize(do))

	// dump a test file with some stuff
	f, err := os.Create(file)
	ifExit(err)
	f.Write([]byte(content))

	return nil
}
コード例 #2
0
ファイル: chains_test.go プロジェクト: jeffanthony/eris-cli
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris-test-nyc2-1.8.1")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	do := def.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	if err := ini.Initialize(do); err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
	}

	// lay a chain service def
	testNewChain(chainName)

	return nil
}
コード例 #3
0
ファイル: testing_utils.go プロジェクト: alexandrev/eris-cli
//testType = one of each package, will switch over it for
//make additional tempDirs and vars as needed -> [zr] or not, TBD
func TestsInit(testType string) (err error) {
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	util.DockerConnect(false, "eris")

	// this dumps the ipfs and keys services defs into the temp dir which
	// has been set as the erisRoot.
	do := def.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	do.Yes = true
	if err := ini.Initialize(do); err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
	}

	if testType == "services" {
		checkIPFSnotRunning() //TODO make more general & use for other things?
	}

	logger.Infoln("Test init completed. Starting main test sequence now.")
	return nil
}
コード例 #4
0
ファイル: testing_utils.go プロジェクト: antonylewis/eris-cli
//testType = one of each package, will switch over it for
//make additional tempDirs and vars as needed -> [zr] or not, TBD
func TestsInit(testType string) (err error) {
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	util.DockerConnect(false, "eris")

	// this dumps the ipfs and keys services defs into the temp dir which
	// has been set as the erisRoot.
	do := def.NowDo()
	do.Pull = false //don't pull imgs
	do.Yes = true   //over-ride command-line prompts
	do.Quiet = true
	// do.Source = "toadserver" //use "rawgit" if ts down
	do.Source = "rawgit" //use "rawgit" if ts down
	if err := ini.Initialize(do); err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir: %s.\n", err))
	}

	log.Info("Test init completed. Starting main test sequence now")
	return nil
}
コード例 #5
0
ファイル: files_test.go プロジェクト: kustomzone/eris-cli
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	ifExit(ini.Initialize(true, false))

	// set ipfs endpoint
	// os.Setenv("ERIS_IPFS_HOST", "http://0.0.0.0") // conflicts with docker-machine based testing

	// dump a test file with some stuff
	f, err := os.Create(file)
	ifExit(err)
	f.Write([]byte(content))

	return nil
}
コード例 #6
0
ファイル: services_test.go プロジェクト: jumanjiman/eris-cli
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	do := def.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	ifExit(ini.Initialize(do))

	// set ipfs endpoint
	//os.Setenv("ERIS_IPFS_HOST", "http://0.0.0.0") //conflicts with docker-machine

	// make sure ipfs not running
	do = def.NowDo()
	do.Quiet = true
	logger.Debugln("Finding the running services.")
	if err := ListRunning(do); err != nil {
		ifExit(err)
	}
	res := strings.Split(do.Result, "\n")
	for _, r := range res {
		if r == "ipfs" {
			ifExit(fmt.Errorf("IPFS service is running.\nPlease stop it with.\neris services stop -rx ipfs\n"))
		}
	}
	// make sure ipfs container does not exist
	do = def.NowDo()
	do.Quiet = true
	if err := ListExisting(do); err != nil {
		ifExit(err)
	}
	res = strings.Split(do.Result, "\n")
	for _, r := range res {
		if r == "ipfs" {
			ifExit(fmt.Errorf("IPFS service exists.\nPlease remove it with\neris services rm ipfs\n"))
		}
	}

	logger.Infoln("Test init completed. Starting main test sequence now.")
	return nil
}
コード例 #7
0
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	if err := os.Mkdir(erisDir, 0777); err != nil {
		ifExit(err)
	}
	config.ChangeErisDir(erisDir)

	return nil
}
コード例 #8
0
func testsInit() error {
	var err error
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	util.DockerConnect(false, "eris")

	log.Info("Test init completed. Starting main test sequence now.")
	return nil

}
コード例 #9
0
ファイル: contracts_test.go プロジェクト: kustomzone/eris-cli
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// clone bank...for now.
	// TODO: add better tester

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	ifExit(ini.Initialize(true, false))

	logger.Infoln("Test init completed. Starting main test sequence now.")
	return nil
}
コード例 #10
0
ファイル: actions_test.go プロジェクト: kustomzone/eris-cli
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	ifExit(ini.Initialize(true, false))

	return nil
}