Describe("Validate", func() {
		Context("valid config", func() {
			It("accepts bootstrap as a value for RepairMode", func() {
				err := rootConfig.Validate()
				Expect(err).NotTo(HaveOccurred())
			})

			It("accepts rejoin-unsafe as a value for RepairMode", func() {
				rootConfig.RepairMode = "rejoin-unsafe"
				err := rootConfig.Validate()
				Expect(err).NotTo(HaveOccurred())
			})
		})

		It("returns an error if HealthcheckURLs is blank", func() {
			err := test_helpers.IsRequiredField(rootConfig, "HealthcheckURLs")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns an error if LogFilePath is blank", func() {
			err := test_helpers.IsRequiredField(rootConfig, "LogFilePath")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns an error if Username is blank", func() {
			err := test_helpers.IsRequiredField(rootConfig, "Username")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns an error if Password is blank", func() {
			err := test_helpers.IsRequiredField(rootConfig, "Password")
Beispiel #2
0
					]
				},
				"ProfilerPort": 6060,
				"HealthPort": 9200,
				"StaticDir": "fake-path",
				"PidFile": "fake-pid-path"
			}`
		})

		It("does not return error on valid config", func() {
			err := rootConfig.Validate()
			Expect(err).NotTo(HaveOccurred())
		})

		It("returns an error if API.Port is blank", func() {
			err := test_helpers.IsRequiredField(rootConfig, "API.Port")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns an error if API.Username is blank", func() {
			err := test_helpers.IsRequiredField(rootConfig, "API.Username")
			Expect(err).ToNot(HaveOccurred())
		})

		It("returns an error if API.Password is blank", func() {
			err := test_helpers.IsRequiredField(rootConfig, "API.Password")
			Expect(err).ToNot(HaveOccurred())
		})

		It("does not return an error if API.ForceHttps is blank", func() {
			err := test_helpers.IsOptionalField(rootConfig, "API.ForceHttps")