"os"
	"sync"
)

// these tests need to be invoked individually from an external script,
// since environment variables need to be set/unset before starting the tests
var _ = Describe("Autowire End-to-End", func() {
	Context("with DROPSONDE_ORIGIN set", func() {
		var oldEnv string

		BeforeEach(func() {
			oldEnv = os.Getenv("DROPSONDE_ORIGIN")
			os.Setenv("DROPSONDE_ORIGIN", "test-origin")
			emitter, _ := autowire.CreateDefaultEmitter()
			autowire.Initialize(emitter)
			metrics.Initialize(metric_sender.NewMetricSender(autowire.AutowiredEmitter()))
		})

		AfterEach(func() {
			os.Setenv("DROPSONDE_ORIGIN", oldEnv)
		})

		It("emits HTTP client/server events and heartbeats", func() {
			udpListener, err := net.ListenPacket("udp4", ":3457")
			Expect(err).ToNot(HaveOccurred())
			defer udpListener.Close()
			udpDataChan := make(chan []byte, 16)

			receivedEvents := make(map[string]bool)
			lock := sync.RWMutex{}
			origin := os.Getenv("DROPSONDE_ORIGIN")
Пример #2
0
func init() {
	Initialize(log_sender.NewLogSender(autowire.AutowiredEmitter(), gosteno.NewLogger("autowire/logs")))
}
Пример #3
0
func init() {
	Initialize(metric_sender.NewMetricSender(autowire.AutowiredEmitter()))
}