Ejemplo n.º 1
0
	})

	JustBeforeEach(func() {
		drainURL, err := url.Parse(drainURL)
		Expect(err).ToNot(HaveOccurred())
		syslogSink = syslog.NewSyslogSink("appId", drainURL, logger, bufferSize, sysLogger, errorHandler, "dropsonde-origin")
	})

	Describe("Identifier", func() {
		Context("with an empty drain URL", func() {
			BeforeEach(func() {
				drainURL = ""
			})

			It("returns an empty string", func() {
				Expect(syslogSink.Identifier()).To(BeEmpty())
			})
		})
	})

	Context("hides sensitive info", func() {

		Context("https", func() {
			BeforeEach(func() {
				drainURL = "https://*****:*****@syslog-host/some/location?user=testuser&password=testpass"
			})

			It("displays only the drain URL host and path", func() {
				Expect(loggertesthelper.TestLoggerSink.LogContents()).ToNot(ContainSubstring("testpass"))
				Expect(loggertesthelper.TestLoggerSink.LogContents()).To(ContainSubstring("Syslog Sink https://syslog-host/some/location: Created for appId [appId]"))
			})