Ejemplo n.º 1
0
func runWebserver(c *cli.Context) {
	pipelinesConfigPath := c.String("config")
	var err error
	webserverConfig, err = config.LoadConfigFromYAMLFile(pipelinesConfigPath)
	if err != nil {
		log.Fatalln(err)
	}

	m := martini.Classic()
	m.Use(render.Renderer())
	m.Use(auth.Basic(webserverConfig.Auth.Username, webserverConfig.Auth.Password))
	m.Get("/", dashboardShowAll)
	m.Get("/tag/:filter", dashboardFilterByTag)
	m.Get("/db", getDatabase)
	m.Post("/upload", binding.Json(upload.BOSH{}), updateBOSH)
	m.Post("/upload/:reallyuuid/deployments/:name", binding.Json(upload.BOSHDeployment{}), updateDeployment)
	m.Post("/upload/:reallyuuid/deployments/:name/data/:label", binding.Json(upload.DeploymentData{}), updateDeploymentExtraData)
	m.Run()
}
Ejemplo n.º 2
0
	BeforeEach(func() {
		expectedRenderData = *TestScenarioData()
		db = data.NewDeploymentsPerBOSH()

		db.FixtureBosh("../upload/fixtures/bosh-lite.json")
		db.FixtureDeployment("../upload/fixtures/deployment-bosh-lite-cf1.json")
		db.FixtureDeployment("../upload/fixtures/deployment-bosh-lite-cf2.json")

		db.FixtureBosh("../upload/fixtures/bosh-vsphere-sandbox.json")
		db.FixtureDeployment("../upload/fixtures/deployment-vsphere-sandbox-cf.json")

		db.FixtureBosh("../upload/fixtures/bosh-aws-production.json")
		db.FixtureDeployment("../upload/fixtures/deployment-aws-production-cf.json")

		var err error
		pipelineConfig, err = config.LoadConfigFromYAMLFile("../config/webserver.config.example.yml")
		Expect(err).NotTo(HaveOccurred())

		renderdata = PrepareRenderData(pipelineConfig, db, "")
	})

	It("has tiers", func() {
		Expect(len(renderdata.Tiers)).To(Equal(len(expectedRenderData.Tiers)))
	})

	It("has slots in tier", func() {
		for tierIndex := range renderdata.Tiers {
			renderTier := renderdata.Tiers[tierIndex]
			Expect(renderTier).ToNot(BeNil())
			expectedTier := *expectedRenderData.Tiers[tierIndex]
			Expect(expectedTier).ToNot(BeNil())