Пример #1
0
func main() {
	config := config.NewConfig()
	err := config.Parse()
	if err != nil {
		panic(err)
	}

	if config.Server == true {
		fmt.Println("Starting in server mode")
		server.Serve()
		server.Bind()
	} else {
		pat.RunCommandLine(config.Concurrency, config.Iterations, config.Silent, config.Output, config.Interval, config.Stop, config.Workload)
	}
}
Пример #2
0
	AfterEach(func() {
		deleteTestFile()
	})

	It("Can read in a configuration file with all peremeters set from a YAML file", func() {
		cfg.Server = true
		cfg.Iterations = 1
		cfg.Concurrency = 1
		cfg.Silent = true
		cfg.Output = "AFileName.csv"
		cfg.Workload = "push,push"
		cfg.Interval = 5
		cfg.Stop = 5
		createTestFile(cfg)

		err := config.Parse()

		Ω(err).Should(BeNil())
		Ω(config.Server).Should(Equal(true))
		Ω(config.Iterations).Should(Equal(1))
		Ω(config.Concurrency).Should(Equal(1))
		Ω(config.Silent).Should(Equal(true))
		Ω(config.Output).Should(Equal("AFileName.csv"))
		Ω(config.Workload).Should(Equal("push,push"))
		Ω(config.Interval).Should(Equal(5))
		Ω(config.Stop).Should(Equal(5))
	})

	It("Can read in a configuration file with only some parameters set from a YAML file", func() {
		cfg.Server = true
		createTestFile(cfg)