monitor_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package monitor
  2. import "testing"
  3. func TestMonitor(t *testing.T) {
  4. // mux := dns.NewServeMux()
  5. // mm := zones.NewMuxManager("dns", mux)
  6. // // s.zones = make(zones.Zones)
  7. // metrics := NewMetrics()
  8. // go metrics.Updater()
  9. // *flaghttp = ":8881"
  10. // fmt.Println("Starting http server")
  11. // // TODO: use httptest
  12. // // https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/Jk785WB7F8I
  13. // srv := Server{}
  14. // srv.
  15. // todo: this isn't right, it should probably just take the mux?
  16. // go httpHandler(mm.Zones())
  17. // time.Sleep(500 * time.Millisecond)
  18. // c.Check(true, DeepEquals, true)
  19. // res, err := http.Get("http://localhost:8881/version")
  20. // c.Assert(err, IsNil)
  21. // page, _ := ioutil.ReadAll(res.Body)
  22. // c.Check(string(page), Matches, ".*<title>GeoDNS [0-9].*")
  23. // res, err = http.Get("http://localhost:8881/status")
  24. // c.Assert(err, IsNil)
  25. // page, _ = ioutil.ReadAll(res.Body)
  26. // // just check that template basically works
  27. // isOk := strings.Contains(string(page), "<html>")
  28. // // page has <html>
  29. // c.Check(isOk, Equals, true)
  30. }