// eris chains new -c _ -csv _ func TestChainsNewConfigAndCSV(t *testing.T) { chainID := "testChainsNewConfigAndCSV" do := def.NowDo() do.Name = chainID do.ConfigFile = path.Join(common.BlockchainsPath, "config", "default", "config.toml") do.CSV = path.Join(common.BlockchainsPath, "config", "default", "genesis.csv") do.Operations.ContainerNumber = 1 logger.Infof("Creating chain (from tests) =>\t%s\n", do.Name) ifExit(NewChain(do)) b, err := ioutil.ReadFile(do.ConfigFile) if err != nil { fatal(t, err) } fmt.Println("CONFIG CONFIG CONFIG:", string(b)) // remove the data container defer removeDataContainer(t, chainID, do.Operations.ContainerNumber) // verify the contents of config.toml do.Name = util.DataContainersName(do.Name, do.Operations.ContainerNumber) args := []string{"cat", fmt.Sprintf("/home/eris/.eris/blockchains/%s/config.toml", chainID)} result := trimResult(string(runContainer(t, do.Name, args))) contents := trimResult(ini.DefChainConfig()) if result != contents { fatal(t, fmt.Errorf("config not properly copied. Got: %s \n Expected: %s", result, contents)) } // verify the contents of genesis.json (should have the validator from the csv) args = []string{"cat", fmt.Sprintf("/home/eris/.eris/blockchains/%s/genesis.json", chainID)} result = string(runContainer(t, do.Name, args)) var found bool for _, s := range strings.Split(result, "\n") { if strings.Contains(s, ini.DefaultPubKeys[0]) { found = true break } } if !found { fatal(t, fmt.Errorf("Did not find pubkey %s in genesis.json: %s", ini.DefaultPubKeys[0], result)) } }
// eris chains new -c _ -csv _ func TestChainsNewConfigAndCSV(t *testing.T) { chainID := "testChainsNewConfigAndCSV" do := def.NowDo() do.Name = chainID do.ConfigFile = path.Join(common.ChainsPath, "default", "config.toml") do.CSV = path.Join(common.ChainsPath, "default", "genesis.csv") do.Operations.ContainerNumber = 1 do.Operations.PublishAllPorts = true logger.Infof("Creating chain (from tests) =>\t%s\n", do.Name) tests.IfExit(NewChain(do)) _, err := ioutil.ReadFile(do.ConfigFile) if err != nil { tests.IfExit(err) } // remove the data container defer removeChainContainer(t, chainID, do.Operations.ContainerNumber) // verify the contents of config.toml ops := loaders.LoadDataDefinition(do.Name, do.Operations.ContainerNumber) util.Merge(ops, do.Operations) ops.Args = []string{"cat", fmt.Sprintf("/home/eris/.eris/chains/%s/config.toml", chainID)} result := trimResult(string(runContainer(t, ops))) contents := trimResult(ini.DefChainConfig()) if result != contents { tests.IfExit(fmt.Errorf("config not properly copied. Got: %s \n Expected: %s", result, contents)) } // verify the contents of genesis.json (should have the validator from the csv) ops = loaders.LoadDataDefinition(do.Name, do.Operations.ContainerNumber) util.Merge(ops, do.Operations) ops.Args = []string{"cat", fmt.Sprintf("/home/eris/.eris/chains/%s/genesis.json", chainID)} result = string(runContainer(t, ops)) var found bool for _, s := range strings.Split(result, "\n") { if strings.Contains(s, ini.DefaultPubKeys[0]) { found = true break } } if !found { tests.IfExit(fmt.Errorf("Did not find pubkey %s in genesis.json: %s", ini.DefaultPubKeys[0], result)) } }