This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tnt test for RouterCallImpl (#56)
* Add tnt test for RouterCallImpl * don't run TestConncurrentTopologyChange parallel with other ones * fix callOpts for RouterCallImpl * review fix for PR #56: replace panic to require.Nil * tests/tnt: store logs of vshard storages * review fix for PR #56 (export envvar) * review fix for #56 - add grants for guest user - update comments
- Loading branch information
1 parent
384bd3b
commit 7938584
Showing
7 changed files
with
76 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package tnt_test | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"math/rand" | ||
"testing" | ||
"time" | ||
|
||
vshardrouter "github.com/KaymeKaydex/go-vshard-router" | ||
"github.com/KaymeKaydex/go-vshard-router/providers/static" | ||
"github.com/stretchr/testify/require" | ||
"github.com/tarantool/go-tarantool/v2/pool" | ||
) | ||
|
||
func TestRouterCall(t *testing.T) { | ||
if !isCorrectRun() { | ||
log.Printf("Incorrect run of tnt-test framework") | ||
return | ||
} | ||
|
||
t.Parallel() | ||
|
||
ctx := context.Background() | ||
|
||
cfg := getCfg() | ||
|
||
router, err := vshardrouter.NewRouter(ctx, vshardrouter.Config{ | ||
TopologyProvider: static.NewProvider(cfg), | ||
DiscoveryTimeout: 5 * time.Second, | ||
DiscoveryMode: vshardrouter.DiscoveryModeOn, | ||
TotalBucketCount: totalBucketCount, | ||
User: defaultTntUser, | ||
Password: defaultTntPassword, | ||
}) | ||
|
||
require.Nil(t, err, "NewRouter finished successfully") | ||
|
||
//nolint:gosec | ||
bucketID := uint64((rand.Int() % totalBucketCount) + 1) | ||
args := []interface{}{"arg1"} | ||
|
||
resp, _, err := router.RouterCallImpl(ctx, bucketID, vshardrouter.CallOpts{ | ||
VshardMode: vshardrouter.ReadMode, | ||
PoolMode: pool.PreferRO, | ||
}, "echo", args) | ||
|
||
require.Nil(t, err, "RouterCallImpl echo finished with no err") | ||
require.EqualValues(t, args, resp, "RouterCallImpl echo resp correct") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters