Beispiel #1
0
func main() {

	setupFlags()
	parseFlags()

	log := logging.GetLogger(opts.LogFile, opts.RemoteSyslog, opts.Syslog,
		opts.Debug, opts.Trace)

	if err := config.LoadConfig(configFile, cfg); err != nil {
		log.Fatalf("%s\n", err)
	}
	// opts - cli options passed to mq
	svgMgr, err := service.NewServiceManager(cfg, opts, log)
	if err != nil {
		log.Fatalf("%s\n", err)
	}

	svgMgr.Start()
}
Beispiel #2
0
func TestMain(m *testing.M) {

	err := config.LoadConfig(testCfgfile, &testInvCfg)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	testInvCfg.Auth.GroupsFile = "../etc/local-groups.json.sample"
	testInvCfg.Events.ConfigFile = "../etc/gnatsd.conf"
	testInvCfg.Auth.Config["htpasswd_file"] = "../etc/htpasswd"

	// Datastore config
	tv, _ := testInvCfg.Datastore.Config.(map[string]interface{})
	tv["mappings_dir"] = "../etc/mappings"
	tv["index"] = "test_core"
	testInvCfg.Datastore.Config = tv

	if testInv, err = NewVindaluCore(&testInvCfg, testLogger); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	go func() {
		for {
			<-testInv.EventQ
		}
	}()

	retval := m.Run()

	// Cleanup
	testInv.datastore.Conn.DeleteIndex("test_core")
	testInv.datastore.Conn.DeleteIndex("test_core_versions")

	os.Exit(retval)
}
import (
	"fmt"
	"os"
	"testing"

	"github.com/vindalu/vindalu/config"
	"github.com/vindalu/vindalu/core"
	"github.com/vindalu/vindalu/logging"
)

var (
	testCfgfile      = "../etc/vindalu.json.sample"
	testHandlerIndex = "test_handler_index"

	testInvCfg config.InventoryConfig
	_          = config.LoadConfig(testCfgfile, &testInvCfg)

	testLogger = logging.GetLogger("", "", false, false, false)
	testDS     *core.InventoryDatastore

	testDsCfg core.EssDatastoreConfig

	testInv *VindaluApiHandler
)

func TestMain(m *testing.M) {

	testInvCfg.Auth.GroupsFile = "../etc/local-groups.json.sample"
	testInvCfg.Events.ConfigFile = "../etc/gnatsd.conf"
	testInvCfg.Auth.Config["htpasswd_file"] = "../etc/htpasswd"