use testhook to run server tests so we can have post-processing and audits

This gives more consistency with the other tests and allows us to get audit
checks on the server/ tests. The tests on the clients being closed are
temporarily disabled because they tend to think the last test's clients
are "still open" for a few seconds after the test completes.
This commit is contained in:
Seebs 2021-02-23 11:49:04 -06:00
parent 2ee589ae1d
commit 8d6f97604f
2 changed files with 10 additions and 4 deletions

View file

@ -873,7 +873,12 @@ type hookedClient struct {
}
func (h *hookedClient) Close() {
_ = testhook.Closed(pilosa.NewAuditor(), h.Client, nil)
// The hook open/closed test here is disabled because there's a
// slight delay before the client actually gets closed in
// some cases, which is long enough to frequently be caught
// if there was a client in the last test run, even though it'd
// be fine a few seconds later.
// _ = testhook.Closed(pilosa.NewAuditor(), h.Client, nil)
h.Client.Close()
}
@ -885,7 +890,8 @@ func (e *Etcd) client() (*hookedClient, error) {
return nil, errors.Wrapf(err, "creates a new etcd client from URLs (%v)", urls)
}
_ = testhook.Opened(pilosa.NewAuditor(), cli, nil)
// Temporarily disabled, see comment in Close above.
// _ = testhook.Opened(pilosa.NewAuditor(), cli, nil)
return &hookedClient{Client: cli}, nil
}

View file

@ -24,7 +24,6 @@ import (
"math/rand"
"net"
nethttp "net/http"
"os"
"reflect"
"sort"
"strings"
@ -38,6 +37,7 @@ import (
"github.com/pilosa/pilosa/v2/roaring"
"github.com/pilosa/pilosa/v2/server"
"github.com/pilosa/pilosa/v2/test"
"github.com/pilosa/pilosa/v2/testhook"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)
@ -1202,7 +1202,7 @@ func TestMain(m *testing.M) {
panic(err)
}
}()
os.Exit(m.Run())
testhook.RunTestsWithHooks(m)
}
// TestClusterCreatedAtRace is a regression test for an issue where