Verification framework and check whether cindex is not decreasing.

This commit is contained in:
Piotr Tabor
2022-04-16 21:50:54 +02:00
parent 52662ccd06
commit d69e07dd3a
11 changed files with 139 additions and 49 deletions

View File

@@ -21,9 +21,9 @@ import (
grpc_logsettable "github.com/grpc-ecosystem/go-grpc-middleware/logging/settable"
"go.etcd.io/etcd/client/pkg/v3/testutil"
"go.etcd.io/etcd/client/pkg/v3/verify"
clientv3 "go.etcd.io/etcd/client/v3"
"go.etcd.io/etcd/server/v3/embed"
"go.etcd.io/etcd/server/v3/verify"
"go.uber.org/zap/zapcore"
"go.uber.org/zap/zapgrpc"
"go.uber.org/zap/zaptest"
@@ -90,18 +90,20 @@ func BeforeTest(t testutil.TB, opts ...TestOption) {
}
previousInsideTestContext := insideTestContext
// Integration tests should verify written state as much as possible.
revertFunc := verify.EnableAllVerifications()
// Registering cleanup early, such it will get executed even if the helper fails.
t.Cleanup(func() {
grpc_logger.Reset()
insideTestContext = previousInsideTestContext
os.Chdir(previousWD)
revertFunc()
})
grpc_logger.Set(zapgrpc.NewLogger(zaptest.NewLogger(t).Named("grpc")))
insideTestContext = true
// Integration tests should verify written state as much as possible.
os.Setenv(verify.ENV_VERIFY, verify.ENV_VERIFY_ALL_VALUE)
os.Chdir(t.TempDir())
}