mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
ci: swap freeport for portal in packages (#15661)
This commit is contained in:
@@ -16,7 +16,6 @@ import (
|
||||
"github.com/hashicorp/nomad/ci"
|
||||
client "github.com/hashicorp/nomad/client/config"
|
||||
"github.com/hashicorp/nomad/client/testutil"
|
||||
"github.com/hashicorp/nomad/helper/freeport"
|
||||
"github.com/hashicorp/nomad/helper/pointer"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/hashicorp/nomad/nomad/structs/config"
|
||||
@@ -660,8 +659,7 @@ func TestConfig_Listener(t *testing.T) {
|
||||
}
|
||||
|
||||
// Works with valid inputs
|
||||
ports := freeport.MustTake(2)
|
||||
defer freeport.Return(ports)
|
||||
ports := ci.PortAllocator.Grab(2)
|
||||
|
||||
ln, err := config.Listener("tcp", "127.0.0.1", ports[0])
|
||||
if err != nil {
|
||||
|
||||
@@ -15,10 +15,10 @@ import (
|
||||
metrics "github.com/armon/go-metrics"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/nomad/api"
|
||||
"github.com/hashicorp/nomad/ci"
|
||||
client "github.com/hashicorp/nomad/client/config"
|
||||
"github.com/hashicorp/nomad/client/fingerprint"
|
||||
"github.com/hashicorp/nomad/helper"
|
||||
"github.com/hashicorp/nomad/helper/freeport"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
"github.com/hashicorp/nomad/nomad"
|
||||
"github.com/hashicorp/nomad/nomad/mock"
|
||||
@@ -269,8 +269,6 @@ func (a *TestAgent) Shutdown() {
|
||||
}
|
||||
a.shutdown = true
|
||||
|
||||
defer freeport.Return(a.ports)
|
||||
|
||||
defer func() {
|
||||
if a.DataDir != "" {
|
||||
_ = os.RemoveAll(a.DataDir)
|
||||
@@ -332,7 +330,7 @@ func (a *TestAgent) Client() *api.Client {
|
||||
// Instead of relying on one set of ports to be sufficient we retry
|
||||
// starting the agent with different ports on port conflict.
|
||||
func (a *TestAgent) pickRandomPorts(c *Config) {
|
||||
ports := freeport.MustTake(3)
|
||||
ports := ci.PortAllocator.Grab(3)
|
||||
a.ports = append(a.ports, ports...)
|
||||
|
||||
c.Ports.HTTP = ports[0]
|
||||
|
||||
@@ -30,8 +30,7 @@ func TestHTTP_Variables(t *testing.T) {
|
||||
|
||||
httpTest(t, cb, func(s *TestAgent) {
|
||||
// These tests are run against the same running server in order to reduce
|
||||
// the costs of server startup and allow as much parallelization as possible
|
||||
// given the port reuse issue that we have seen with the current freeport
|
||||
// the costs of server startup and allow as much parallelization as possible.
|
||||
t.Run("error_badverb_list", func(t *testing.T) {
|
||||
req, err := http.NewRequest("LOLWUT", "/v1/vars", nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user