Пример #1
0
func setLogLevel(c *cli.Context) {
	logFlag := c.String(logLevel)
	var logLevel logging.LogLevel
	err := logLevel.UnmarshalJSON([]byte(logFlag))
	if err != nil {
		quit(fmt.Sprintf("Unable to parse log level: %s", logFlag), c)
	}

	logging.SetLevel(logLevel)
}
Пример #2
0
	"github.com/onsi/gomega/gexec"
)

func TestKvstore(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Kvstore Suite")
}

var (
	consulSession *gexec.Session
	tmpDir        string
	consulClient  *api.Client
)

var _ = BeforeSuite(func() {
	logging.SetLevel(logging.CRITICAL)
	consulPath, err := gexec.Build("github.com/hashicorp/consul")
	Expect(err).ToNot(HaveOccurred())

	tmpDir, err = ioutil.TempDir("", "consul")
	Expect(err).ToNot(HaveOccurred())

	consulCmd := exec.Command(consulPath, "agent", "-server", "-bootstrap-expect", "1", "-data-dir", tmpDir, "-bind", "127.0.0.1")
	consulSession, err = gexec.Start(consulCmd, nil, nil)
	Expect(err).ToNot(HaveOccurred())
	Consistently(consulSession).ShouldNot(gexec.Exit())

	consulClient, err = api.NewClient(api.DefaultConfig())
	Expect(err).ToNot(HaveOccurred())

	f := func() error {
Пример #3
0
func TestBroker(t *testing.T) {
	logging.SetLevel(logging.CRITICAL)
	RegisterFailHandler(Fail)
	RunSpecs(t, "Broker Suite")
}