Esempio n. 1
0
func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	util.GlobalConfig, err = util.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.
	util.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
	if err := ini.Initialize(true, false); err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
	}

	return nil
}
Esempio n. 2
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)

	// 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
}
Esempio n. 3
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)
	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
}
Esempio n. 4
0
//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
}
Esempio n. 5
0
//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
}
Esempio n. 6
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)

	// 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
}
Esempio n. 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)

	// 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
}
Esempio n. 8
0
func Router(cmd *cobra.Command, args []string) {
	if do.Yes {
		do.Services = true
		do.Actions = true
	}

	if !do.Pull {
		util.CheckGitAndGo(true, false)
	}

	ini.Initialize(do)
}
Esempio n. 9
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)

	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
}
Esempio n. 10
0
func Router(cmd *cobra.Command, args []string) {
	switch {
	case do.Yes:
		do.Services = true
		do.Actions = true
	case do.All:
		do.Services = true
		do.Actions = true
		do.Tool = true
	}

	if do.Tool {
		util.UpdateEris(do.Branch)

		if !do.All {
			return
		}
	}

	ini.Initialize(do)
}
Esempio n. 11
0
func Router(cmd *cobra.Command, args []string) {
	ini.Initialize(do)
}
Esempio n. 12
0
package commands

import (
	"github.com/eris-ltd/eris-cli/Godeps/_workspace/src/github.com/spf13/cobra"
	ini "github.com/eris-ltd/eris-cli/initialize"
)

// flags to add: --no-clone
var Init = &cobra.Command{
	Use:   "init",
	Short: "Initialize the ~/.eris directory with some default services and actions",
	Long: `Create the ~/.eris directory with actions and services subfolders
and clone eris-ltd/eris-actions eris-ltd/eris-services into them, respectively.
`,
	Run: func(cmd *cobra.Command, args []string) {
		ini.Initialize(do.SkipPull, do.Verbose)
	},
}
Esempio n. 13
0
package commands

import (
	"github.com/eris-ltd/eris-cli/Godeps/_workspace/src/github.com/spf13/cobra"
	ini "github.com/eris-ltd/eris-cli/initialize"
)

// flags to add: --no-clone
var Init = &cobra.Command{
	Use:   "init",
	Short: "Initialize the ~/.eris directory with some default services and actions",
	Long: `Create the ~/.eris directory with actions and services subfolders
and clone eris-ltd/eris-actions eris-ltd/eris-services into them, respectively.
`,
	Run: func(cmd *cobra.Command, args []string) {
		ini.Initialize(do.Pull, do.Verbose)
	},
}
Esempio n. 14
0
func UpdateTool(cmd *cobra.Command, args []string) {
	util.UpdateEris(do.Branch, true, true)
	initialize.Initialize(do)
}