Beispiel #1
0
func TestFailuresMetricaBasic(t *testing.T) {
	observable := new(TestObservable)
	m := &FailuresMetrica{observable}
	val, err := m.GetValue()
	assert.Equals(t, val, 0.0)
	assert.Ok(t, err)
}
Beispiel #2
0
func TestFailuresStats(t *testing.T) {
	response := NewMartiniRecorder()

	martiniApp := App()

	_, failures := MembersBroker.GetStats()

	assert.Equals(t, failures, 0)
	request, err := http.NewRequest("POST", "/failure", nil)
	assert.Ok(t, err)

	martiniApp.ServeHTTP(response, request)

	assert.Equals(t, response.Code, http.StatusOK)

	_, failures = MembersBroker.GetStats()
	assert.Equals(t, failures, 1)
	//	ensure counter reset
	_, failures = MembersBroker.GetStats()
	assert.Equals(t, failures, 0)

}