PMM-12468 Fix to run stats tests and other tests with testing.M.

This commit is contained in:
Jiří Čtvrtka
2025-02-03 14:14:53 +01:00
parent 6c2dec8502
commit 5972093d87
4 changed files with 16 additions and 10 deletions

View File

@@ -10,11 +10,12 @@ import (
"strings"
"testing"
"github.com/percona/percona-toolkit/src/go/lib/tutil"
"github.com/percona/percona-toolkit/src/go/mongolib/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.mongodb.org/mongo-driver/bson"
"github.com/percona/percona-toolkit/src/go/lib/tutil"
"github.com/percona/percona-toolkit/src/go/mongolib/proto"
)
const (
@@ -33,7 +34,8 @@ func TestMain(m *testing.M) {
log.Printf("cannot get root path: %s", err.Error())
os.Exit(1)
}
os.Exit(m.Run())
code := m.Run()
os.Exit(code)
}
func TestSingleFingerprint(t *testing.T) {

View File

@@ -7,14 +7,15 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.mongodb.org/mongo-driver/bson/primitive"
tu "github.com/percona/percona-toolkit/src/go/internal/testutils"
"github.com/percona/percona-toolkit/src/go/lib/tutil"
"github.com/percona/percona-toolkit/src/go/mongolib/fingerprinter"
"github.com/percona/percona-toolkit/src/go/mongolib/stats"
"github.com/percona/percona-toolkit/src/go/pt-mongodb-query-digest/filter"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.mongodb.org/mongo-driver/bson/primitive"
)
const (
@@ -38,7 +39,8 @@ func TestMain(m *testing.M) {
log.Printf("cannot get root path: %s", err.Error())
os.Exit(1)
}
os.Exit(m.Run())
code := m.Run()
os.Exit(code)
}
func TestRegularIterator(t *testing.T) {

View File

@@ -14,6 +14,7 @@ import (
"time"
"github.com/golang/mock/gomock"
"github.com/percona/percona-toolkit/src/go/lib/tutil"
"github.com/percona/percona-toolkit/src/go/mongolib/fingerprinter"
"github.com/percona/percona-toolkit/src/go/mongolib/proto"
@@ -40,8 +41,8 @@ func TestMain(m *testing.M) {
log.Printf("cannot get root path: %s", err.Error())
os.Exit(1)
}
// TODO: Review with the new sandbox
// os.Exit(m.Run())
code := m.Run()
os.Exit(code)
}
func TestTimesLen(t *testing.T) {

View File

@@ -32,7 +32,8 @@ var logger = logrus.New()
func TestMain(m *testing.M) {
logger.SetLevel(logrus.WarnLevel)
os.Exit(m.Run())
code := m.Run()
os.Exit(code)
}
func TestConnection(t *testing.T) {