status_test.go 378 B

12345678910111213141516171819
  1. package health
  2. import "testing"
  3. func TestStatusFile(t *testing.T) {
  4. sf := NewStatusFile("test.json")
  5. err := sf.Load("test.json")
  6. if err != nil {
  7. t.Fatalf("could not load test.json: %s", err)
  8. }
  9. x := sf.GetStatus("bad")
  10. t.Logf("bad=%d", x)
  11. if x != StatusUnhealthy {
  12. t.Errorf("'bad' should have been unhealthy but was %s", x.String())
  13. }
  14. registry.Add("test", sf)
  15. }