func (t *ETCDHelper) SetRawDomain(domain string) { _, err := t.client.Set(etcddb.DomainSchemaPath(domain), []byte{}, 0) Expect(err).NotTo(HaveOccurred()) }
var _ = Describe("Domain API", func() { BeforeEach(func() { bbsRunner = testrunner.New(bbsBinPath, bbsArgs) bbsProcess = ginkgomon.Invoke(bbsRunner) }) AfterEach(func() { ginkgomon.Kill(bbsProcess) }) Describe("UpsertDomain", func() { var existingDomain string BeforeEach(func() { existingDomain = "existing-domain" _, err := etcdClient.Set(etcddb.DomainSchemaPath(existingDomain), "", 100) Expect(err).NotTo(HaveOccurred()) }) It("does emit latency metrics", func() { err := client.UpsertDomain(existingDomain, 200*time.Second) Expect(err).ToNot(HaveOccurred()) var sawRequestLatency bool timeout := time.After(50 * time.Millisecond) OUTER_LOOP: for { select { case envelope := <-testMetricsChan: if envelope.GetEventType() == events.Envelope_ValueMetric { if *envelope.ValueMetric.Name == "RequestLatency" {
for rows.Next() { var tableName string err := rows.Scan(&tableName) Expect(err).NotTo(HaveOccurred()) tables = append(tables, tableName) } Expect(tables).To(ContainElement("domains")) Expect(tables).To(ContainElement("desired_lrps")) Expect(tables).To(ContainElement("actual_lrps")) Expect(tables).To(ContainElement("tasks")) }) }) Describe("Domains", func() { BeforeEach(func() { _, err := storeClient.Set(etcddb.DomainSchemaPath("domain-1"), []byte(""), 100) Expect(err).NotTo(HaveOccurred()) _, err = storeClient.Set(etcddb.DomainSchemaPath("domain-2"), []byte(""), 100) Expect(err).NotTo(HaveOccurred()) }) It("creates a domain entry in sql for each domain in etcd", func() { Expect(migrationErr).NotTo(HaveOccurred()) rows, err := rawSQLDB.Query(`SELECT domain, expire_time FROM domains`) Expect(err).NotTo(HaveOccurred()) defer rows.Close() domains := map[string]int64{} for rows.Next() { var domain string