|
|
|
@ -55,6 +55,29 @@ func Test_NewService(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_HasVersionHeader(t *testing.T) {
|
|
|
|
|
m := &MockStore{}
|
|
|
|
|
s := New("127.0.0.1:0", m, nil)
|
|
|
|
|
if err := s.Start(); err != nil {
|
|
|
|
|
t.Fatalf("failed to start service")
|
|
|
|
|
}
|
|
|
|
|
defer s.Close()
|
|
|
|
|
s.BuildInfo = map[string]interface{}{
|
|
|
|
|
"version": "the version",
|
|
|
|
|
}
|
|
|
|
|
host := fmt.Sprintf("http://%s", s.Addr().String())
|
|
|
|
|
|
|
|
|
|
client := &http.Client{}
|
|
|
|
|
resp, err := client.Get(host + "/db/xxx")
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("failed to make request")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if resp.Header.Get("X-RQLITE-VERSION") != "the version" {
|
|
|
|
|
t.Fatalf("build version not present in HTTP resspone header")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_404Routes(t *testing.T) {
|
|
|
|
|
m := &MockStore{}
|
|
|
|
|
s := New("127.0.0.1:0", m, nil)
|
|
|
|
|