Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove RandomAlphaNum #178

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions internal/db/dbclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ package db_test
import (
"context"
"fmt"
"log"
"os"
"testing"
"time"

"github.com/babylonlabs-io/babylon-staking-indexer/internal/config"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/db"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/db/model"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/utils"
"github.com/babylonlabs-io/babylon-staking-indexer/testutil"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
"github.com/stretchr/testify/require"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"log"
"os"
"testing"
"time"
)

const (
Expand Down Expand Up @@ -81,7 +82,7 @@ func setupMongoContainer() (*config.DbConfig, func(), error) {

// there can be only 1 container with the same name, so we add
// random string in the end in case there is still old container running
containerName := "mongo-integration-tests-db-" + utils.RandomAlphaNum(3)
containerName := "mongo-integration-tests-db-" + testutil.RandomAlphaNum(3)
resource, err := pool.RunWithOptions(&dockertest.RunOptions{
Name: containerName,
Repository: "mongo",
Expand Down
13 changes: 7 additions & 6 deletions internal/db/timelock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ package db_test

import (
"context"
"math"
"testing"

"github.com/babylonlabs-io/babylon-staking-indexer/internal/db/model"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/types"
"github.com/babylonlabs-io/babylon-staking-indexer/internal/utils"
"github.com/babylonlabs-io/babylon-staking-indexer/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"math"
"testing"
)

func TestTimeLock(t *testing.T) {
Expand All @@ -25,17 +26,17 @@ func TestTimeLock(t *testing.T) {
})
t.Run("find documents", func(t *testing.T) {
expiredDelegation1 := model.TimeLockDocument{
StakingTxHashHex: utils.RandomAlphaNum(10),
StakingTxHashHex: testutil.RandomAlphaNum(10),
ExpireHeight: 1,
DelegationSubState: types.SubStateTimelock,
}
expiredDelegation2 := model.TimeLockDocument{
StakingTxHashHex: utils.RandomAlphaNum(10),
StakingTxHashHex: testutil.RandomAlphaNum(10),
ExpireHeight: 5,
DelegationSubState: types.SubStateTimelock,
}
nonExpiredDelegation := model.TimeLockDocument{
StakingTxHashHex: utils.RandomAlphaNum(10),
StakingTxHashHex: testutil.RandomAlphaNum(10),
ExpireHeight: 10,
DelegationSubState: types.SubStateTimelock,
}
Expand Down
21 changes: 0 additions & 21 deletions internal/utils/rand_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion internal/utils/rand.go → testutil/rand.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package utils
package testutil

import (
"math/rand"
Expand Down
Loading