"integration_tests/metron/metrics"

	"metron/writers/messageaggregator"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Self Instrumentation", func() {
	var (
		testDoppler *metrics.TestDoppler
	)

	BeforeEach(func() {
		testDoppler = metrics.NewTestDoppler()
		go testDoppler.Start()

		announceToEtcd()
	})

	AfterEach(func() {
		testDoppler.Stop()
	})

	It("sends metrics about the Dropsonde network reader", func() {
		metronInput, _ := net.Dial("udp4", "localhost:51161")

		metronInput.Write(basicValueMessage())

		expected := events.Envelope{
	"doppler/dopplerservice"
	"integration_tests/metron/metrics"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Self Instrumentation", func() {
	var (
		testDoppler  *metrics.TestDoppler
		stopAnnounce chan chan bool
		metronInput  net.Conn
	)

	BeforeEach(func() {
		testDoppler = metrics.NewTestDoppler(metronRunner.DropsondeAddress())
		go testDoppler.Start()

		dopplerConfig := &dopplerconfig.Config{
			Index:           "0",
			JobName:         "job",
			Zone:            "z9",
			IncomingUDPPort: uint32(metronRunner.DropsondePort),
		}

		stopAnnounce = dopplerservice.Announce("127.0.0.1", time.Minute, dopplerConfig, etcdAdapter, gosteno.NewLogger("test"))

		metronRunner.Protocols = config.Protocols{"udp": struct{}{}}
		metronRunner.Start()

		env := basicValueMessageEnvelope()