func validateEsRunning(t *testing.T) { _, e := index.Status() if e != nil { tskip.Errorf(t, 1, "ElasticSearch is not running on %s. %s", index.BaseUrl(), e.Error()) t.FailNow() } }
func mustReadFixture(t *testing.T, name string) []byte { b, e := ioutil.ReadFile("fixtures/" + name) if e != nil { tskip.Errorf(t, 1, "unable to read fixute %q: %q", name, e) t.FailNow() } return b }
func mustReadFixture(t *testing.T, name string) []byte { b, e := ioutil.ReadFile("fixtures/" + name) if e != nil { tskip.Errorf(t, 1, "error reading fixture %s", e) t.FailNow() } return b }
func TestFunc(t *testing.T) { if !doSimulate() { t.SkipNow() } tc := func(s, prefix, expected string) { if value := strings.TrimPrefix(s, prefix); value != expected { tskip.Errorf(t, 1, "TrimPrefix %q for %q should return %q, was %q", prefix, s, expected, value) } } tc("a test", "a", " test") tc("a test", "a test", "") tc("a test", "b", "") }
// this is the implementation of assertEqual func assertEqual(t *testing.T, a, b interface{}, messages ...interface{}) { if a != b { tskip.Errorf(t, 1, diffMessage(messageString(messages), a, b)) } }
func (s *Assert) NoError(err error) { if err != nil { tskip.Errorf(s.t, s.skip+1, "expected no error, got %s", err) } }
func (s *Assert) FailIfError(err error) { if err != nil { tskip.Errorf(s.t, s.skip+1, "expected no error, got %s", err) s.t.FailNow() } }
func (s *Assert) ErrorIfNil(i interface{}, messages ...interface{}) { if i == nil { tskip.Errorf(s.t, s.skip+1, messageString("must be not nil, was nil", messages)) } }
func (s *Assert) FailIfNil(i interface{}, messages ...interface{}) { if i == nil { tskip.Errorf(s.t, s.skip+1, messageString("expected not nil, was nil", messages)) s.t.FailNow() } }
func (s *Assert) Equal(a, b interface{}, messages ...interface{}) { if !isEqual(a, b) { tskip.Errorf(s.t, s.skip+2, diffMessage(messageString("not equal", messages), a, b)) } }
func assertNoError(t *testing.T, err error) { if err != nil { tskip.Errorf(t, 1, "expected no error, got %s", err) } }
func failIfError(t *testing.T, err error) { if err != nil { tskip.Errorf(t, 1, "expected no error, got %s", err) t.FailNow() } }
func errorIfNil(t *testing.T, i interface{}, messages ...interface{}) { if t == nil { tskip.Errorf(t, 1, messageString("must be not nil, was nil", messages)) } }
func failIfNil(t *testing.T, i interface{}, messages ...interface{}) { if t == nil { tskip.Errorf(t, 1, messageString("expected not nil, was nil", messages)) t.FailNow() } }
// this is the implementation of assertEqual func assertEqual(t *testing.T, a, b interface{}, messages ...interface{}) { if !isEqual(a, b) { tskip.Errorf(t, 1, diffMessage(messageString("not equal", messages), a, b)) } }