Example #1
0
// test scribble cache init
func TestScribbleInitialize(t *testing.T) {
	config.L2Connect = "/tmp/shamanCache" // default
	err := cache.Initialize()
	config.L2Connect = "!@#$%^&*()" // unparse-able
	err2 := cache.Initialize()
	config.L2Connect = "scribble:///roots/file" // unable to init? (test no sudo)
	err3 := cache.Initialize()
	config.L2Connect = "scribble:///" // defaulting to "/var/db"
	cache.Initialize()
	if err != nil || err2 == nil || err3 != nil {
		t.Errorf("Failed to initalize scribble cacher - %v%v%v", err, err2, err3)
	}
}
Example #2
0
// test nil cache init
func TestNoneInitialize(t *testing.T) {
	config.L2Connect = "none://"
	err := cache.Initialize()
	if err != nil {
		t.Errorf("Failed to initalize none cacher - %v", err)
	}
}
Example #3
0
func startShaman(ccmd *cobra.Command, args []string) error {
	config.Log = lumber.NewConsoleLogger(lumber.LvlInt(config.LogLevel))

	// initialize cache
	err := cache.Initialize()
	if err != nil {
		config.Log.Fatal(err.Error())
		return err
	}

	// make channel for errors
	errors := make(chan error)

	go func() {
		errors <- api.Start()
	}()
	go func() {
		errors <- server.Start()
	}()

	// break if any of them return an error (blocks exit)
	if err := <-errors; err != nil {
		config.Log.Fatal(err.Error())
	}
	return err
}
Example #4
0
func noneReset() {
	config.L2Connect = "none://"
	cache.Initialize()
}
Example #5
0
func scribbleReset() {
	os.RemoveAll("/tmp/shamanCache")
	config.L2Connect = "scribble:///tmp/shamanCache"
	cache.Initialize()
}