func TestAssemblyfileErrors(t *testing.T) {
	//io error
	u := unreadable{}
	_, err := af.Read(u)
	expected := "could not read, because broken"
	if err.Error() != expected {
		t.Error("Expected", err.Error(), "to equal", expected)
	}

	//invalid assemblyfile
	assemblyfile, _ := os.Open("Assemblyfile.broken")
	_, err = af.Read(assemblyfile)
	expected = "toml: unmarshal"
	if err.Error()[0:15] != expected {
		t.Error("Expected", err.Error()[0:15], "to equal", expected)
	}
}
Example #2
0
func main() {
	defer handleFatal()

	confFile, err := os.Open("/etc/assemblyline/spanner/" + os.Args[1] + ".toml")
	check(err)
	config, err := config.Read(confFile)
	check(err)

	assemblyFile, err := os.Open("Assemblyfile")
	check(err)
	af, err := assemblyfile.Read(assemblyFile)
	check(err)

	c := cache.New(af.Hash(), fileStore)

	l.Title("Building", af.Application.Name, "with", config.Spanner.Name, config.Spanner.Version, config.Spanner.Task)
	for _, step := range config.Step {
		step.Cache = c
		err := step.Exec()
		check(err)
	}
}
func fixture() af.Config {
	assemblyfile, _ := os.Open("Assemblyfile.fixture")
	config, _ := af.Read(assemblyfile)
	return config
}