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

tests: fix rpc limit tests #12364

Merged
merged 3 commits into from
Mar 24, 2022
Merged
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
10 changes: 10 additions & 0 deletions nomad/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"time"

"github.com/hashicorp/go-msgpack/codec"
"github.com/hashicorp/go-sockaddr"
msgpackrpc "github.com/hashicorp/net-rpc-msgpackrpc"
"github.com/hashicorp/nomad/ci"
cstructs "github.com/hashicorp/nomad/client/structs"
Expand Down Expand Up @@ -868,6 +869,15 @@ func TestRPC_Limits_OK(t *testing.T) {
}
c.RPCHandshakeTimeout = tc.timeout
c.RPCMaxConnsPerClient = tc.limit

// Bind the server to a private IP so that Autopilot's
// StatsFetcher requests come from a different IP than the test
// requests, otherwise they would interfere with the connection
// rate limiter since limits are imposed by IP address.
ip, err := sockaddr.GetPrivateIP()
require.NoError(t, err)
c.RPCAddr.IP = []byte(ip)
c.SerfConfig.MemberlistConfig.BindAddr = ip
})
defer func() {
cleanup()
Expand Down