Add testing interfaces
This commit is contained in:
parent
ad7bc0c6bd
commit
a6dfffa4fa
|
@ -17,7 +17,7 @@ func TestClient_ACL_resolveTokenValue(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
|
@ -66,7 +66,7 @@ func TestClient_ACL_resolvePolicies(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
|
@ -106,7 +106,7 @@ func TestClient_ACL_ResolveToken_Disabled(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -122,7 +122,7 @@ func TestClient_ACL_ResolveToken(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
|
|
|
@ -177,7 +177,7 @@ func TestPrevAlloc_StreamAllocDir_Ok(t *testing.T) {
|
|||
}
|
||||
defer os.RemoveAll(dir1)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = nil
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
func TestClientStats_Stats(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
client := testClient(t, nil)
|
||||
client := TestClient(t, nil)
|
||||
|
||||
req := &structs.ClientStatsRequest{}
|
||||
var resp structs.ClientStatsResponse
|
||||
|
@ -30,7 +30,7 @@ func TestClientStats_Stats_ACL(t *testing.T) {
|
|||
server, addr, root := testACLServer(t, nil)
|
||||
defer server.Shutdown()
|
||||
|
||||
client := testClient(t, func(c *config.Config) {
|
||||
client := TestClient(t, func(c *config.Config) {
|
||||
c.Servers = []string{addr}
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
|
|
|
@ -4,21 +4,15 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/lib/freeport"
|
||||
memdb "github.com/hashicorp/go-memdb"
|
||||
"github.com/hashicorp/nomad/client/config"
|
||||
"github.com/hashicorp/nomad/client/driver"
|
||||
"github.com/hashicorp/nomad/client/fingerprint"
|
||||
"github.com/hashicorp/nomad/command/agent/consul"
|
||||
"github.com/hashicorp/nomad/helper"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
"github.com/hashicorp/nomad/helper/uuid"
|
||||
"github.com/hashicorp/nomad/nomad"
|
||||
"github.com/hashicorp/nomad/nomad/mock"
|
||||
|
@ -33,110 +27,18 @@ import (
|
|||
)
|
||||
|
||||
func testACLServer(t *testing.T, cb func(*nomad.Config)) (*nomad.Server, string, *structs.ACLToken) {
|
||||
server, addr := testServer(t, func(c *nomad.Config) {
|
||||
c.ACLEnabled = true
|
||||
if cb != nil {
|
||||
cb(c)
|
||||
}
|
||||
})
|
||||
token := mock.ACLManagementToken()
|
||||
err := server.State().BootstrapACLTokens(1, 0, token)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to bootstrap ACL token: %v", err)
|
||||
}
|
||||
return server, addr, token
|
||||
server, token := nomad.TestACLServer(t, cb)
|
||||
return server, server.GetConfig().RPCAddr.String(), token
|
||||
}
|
||||
|
||||
func testServer(t *testing.T, cb func(*nomad.Config)) (*nomad.Server, string) {
|
||||
// Setup the default settings
|
||||
config := nomad.DefaultConfig()
|
||||
config.VaultConfig.Enabled = helper.BoolToPtr(false)
|
||||
config.Build = "unittest"
|
||||
config.DevMode = true
|
||||
|
||||
// Tighten the Serf timing
|
||||
config.SerfConfig.MemberlistConfig.BindAddr = "127.0.0.1"
|
||||
config.SerfConfig.MemberlistConfig.SuspicionMult = 2
|
||||
config.SerfConfig.MemberlistConfig.RetransmitMult = 2
|
||||
config.SerfConfig.MemberlistConfig.ProbeTimeout = 50 * time.Millisecond
|
||||
config.SerfConfig.MemberlistConfig.ProbeInterval = 100 * time.Millisecond
|
||||
config.SerfConfig.MemberlistConfig.GossipInterval = 100 * time.Millisecond
|
||||
|
||||
// Tighten the Raft timing
|
||||
config.RaftConfig.LeaderLeaseTimeout = 20 * time.Millisecond
|
||||
config.RaftConfig.HeartbeatTimeout = 40 * time.Millisecond
|
||||
config.RaftConfig.ElectionTimeout = 40 * time.Millisecond
|
||||
config.RaftConfig.StartAsLeader = true
|
||||
config.RaftTimeout = 500 * time.Millisecond
|
||||
|
||||
logger := log.New(config.LogOutput, "", log.LstdFlags)
|
||||
catalog := consul.NewMockCatalog(logger)
|
||||
|
||||
// Invoke the callback if any
|
||||
if cb != nil {
|
||||
cb(config)
|
||||
}
|
||||
|
||||
// Enable raft as leader if we have bootstrap on
|
||||
config.RaftConfig.StartAsLeader = !config.DevDisableBootstrap
|
||||
|
||||
for i := 10; i >= 0; i-- {
|
||||
ports := freeport.GetT(t, 2)
|
||||
config.RPCAddr = &net.TCPAddr{
|
||||
IP: []byte{127, 0, 0, 1},
|
||||
Port: ports[0],
|
||||
}
|
||||
config.NodeName = fmt.Sprintf("Node %d", config.RPCAddr.Port)
|
||||
config.SerfConfig.MemberlistConfig.BindPort = ports[1]
|
||||
|
||||
// Create server
|
||||
server, err := nomad.NewServer(config, catalog, logger)
|
||||
if err == nil {
|
||||
return server, config.RPCAddr.String()
|
||||
} else if i == 0 {
|
||||
t.Fatalf("err: %v", err)
|
||||
} else {
|
||||
wait := time.Duration(rand.Int31n(2000)) * time.Millisecond
|
||||
time.Sleep(wait)
|
||||
}
|
||||
}
|
||||
return nil, ""
|
||||
}
|
||||
|
||||
func testClient(t *testing.T, cb func(c *config.Config)) *Client {
|
||||
conf := config.DefaultConfig()
|
||||
conf.VaultConfig.Enabled = helper.BoolToPtr(false)
|
||||
conf.DevMode = true
|
||||
conf.Node = &structs.Node{
|
||||
Reserved: &structs.Resources{
|
||||
DiskMB: 0,
|
||||
},
|
||||
}
|
||||
|
||||
// Tighten the fingerprinter timeouts
|
||||
if conf.Options == nil {
|
||||
conf.Options = make(map[string]string)
|
||||
}
|
||||
conf.Options[fingerprint.TightenNetworkTimeoutsConfig] = "true"
|
||||
|
||||
if cb != nil {
|
||||
cb(conf)
|
||||
}
|
||||
|
||||
logger := testlog.Logger(t)
|
||||
catalog := consul.NewMockCatalog(logger)
|
||||
mockService := newMockConsulServiceClient()
|
||||
mockService.logger = logger
|
||||
client, err := NewClient(conf, catalog, mockService, logger)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
return client
|
||||
server := nomad.TestServer(t, cb)
|
||||
return server, server.GetConfig().RPCAddr.String()
|
||||
}
|
||||
|
||||
func TestClient_StartStop(t *testing.T) {
|
||||
t.Parallel()
|
||||
client := testClient(t, nil)
|
||||
client := TestClient(t, nil)
|
||||
if err := client.Shutdown(); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
@ -148,7 +50,7 @@ func TestClient_BaseLabels(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
client := testClient(t, nil)
|
||||
client := TestClient(t, nil)
|
||||
if err := client.Shutdown(); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
@ -173,7 +75,7 @@ func TestClient_RPC(t *testing.T) {
|
|||
s1, addr := testServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.Servers = []string{addr}
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -193,7 +95,7 @@ func TestClient_RPC_Passthrough(t *testing.T) {
|
|||
s1, _ := testServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -214,7 +116,7 @@ func TestClient_Fingerprint(t *testing.T) {
|
|||
|
||||
driver.CheckForMockDriver(t)
|
||||
|
||||
c := testClient(t, nil)
|
||||
c := TestClient(t, nil)
|
||||
defer c.Shutdown()
|
||||
|
||||
// Ensure default values are present
|
||||
|
@ -226,7 +128,7 @@ func TestClient_Fingerprint(t *testing.T) {
|
|||
|
||||
func TestClient_HasNodeChanged(t *testing.T) {
|
||||
t.Parallel()
|
||||
c := testClient(t, nil)
|
||||
c := TestClient(t, nil)
|
||||
defer c.Shutdown()
|
||||
|
||||
node := c.config.Node
|
||||
|
@ -262,7 +164,7 @@ func TestClient_Fingerprint_Periodic(t *testing.T) {
|
|||
|
||||
// these constants are only defined when nomad_test is enabled, so these fail
|
||||
// our linter without explicit disabling.
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.Options = map[string]string{
|
||||
driver.ShutdownPeriodicAfter: "true", // nolint: varcheck
|
||||
driver.ShutdownPeriodicDuration: "3", // nolint: varcheck
|
||||
|
@ -318,7 +220,7 @@ func TestClient_MixedTLS(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.Servers = []string{addr}
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -368,7 +270,7 @@ func TestClient_BadTLS(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.Servers = []string{addr}
|
||||
c.TLSConfig = &nconfig.TLSConfig{
|
||||
EnableHTTP: true,
|
||||
|
@ -406,7 +308,7 @@ func TestClient_Register(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -440,7 +342,7 @@ func TestClient_Heartbeat(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -472,7 +374,7 @@ func TestClient_UpdateAllocStatus(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -523,7 +425,7 @@ func TestClient_WatchAllocs(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -618,7 +520,7 @@ func TestClient_SaveRestoreState(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.DevMode = false
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
|
@ -735,7 +637,7 @@ func TestClient_BlockedAllocations(t *testing.T) {
|
|||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.RPCHandler = s1
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -846,7 +748,7 @@ func TestClient_ValidateMigrateToken_ValidToken(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
c := testClient(t, func(c *config.Config) {
|
||||
c := TestClient(t, func(c *config.Config) {
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
defer c.Shutdown()
|
||||
|
@ -862,7 +764,7 @@ func TestClient_ValidateMigrateToken_InvalidToken(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
c := testClient(t, func(c *config.Config) {
|
||||
c := TestClient(t, func(c *config.Config) {
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
defer c.Shutdown()
|
||||
|
@ -878,7 +780,7 @@ func TestClient_ValidateMigrateToken_ACLDisabled(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
c := testClient(t, func(c *config.Config) {})
|
||||
c := TestClient(t, func(c *config.Config) {})
|
||||
defer c.Shutdown()
|
||||
|
||||
assert.Equal(c.ValidateMigrateToken("", ""), true)
|
||||
|
@ -900,7 +802,7 @@ func TestClient_ReloadTLS_UpgradePlaintextToTLS(t *testing.T) {
|
|||
fookey = "../helper/tlsutil/testdata/nomad-foo-key.pem"
|
||||
)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.Servers = []string{addr}
|
||||
})
|
||||
defer c1.Shutdown()
|
||||
|
@ -976,7 +878,7 @@ func TestClient_ReloadTLS_DowngradeTLSToPlaintext(t *testing.T) {
|
|||
fookey = "../helper/tlsutil/testdata/nomad-foo-key.pem"
|
||||
)
|
||||
|
||||
c1 := testClient(t, func(c *config.Config) {
|
||||
c1 := TestClient(t, func(c *config.Config) {
|
||||
c.Servers = []string{addr}
|
||||
c.TLSConfig = &nconfig.TLSConfig{
|
||||
EnableHTTP: true,
|
||||
|
|
|
@ -298,7 +298,7 @@ func TestAllocGarbageCollector_MaxAllocs(t *testing.T) {
|
|||
testutil.WaitForLeader(t, server.RPC)
|
||||
|
||||
const maxAllocs = 6
|
||||
client := testClient(t, func(c *config.Config) {
|
||||
client := TestClient(t, func(c *config.Config) {
|
||||
c.GCMaxAllocs = maxAllocs
|
||||
c.GCDiskUsageThreshold = 100
|
||||
c.GCInodeUsageThreshold = 100
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/nomad/client/config"
|
||||
"github.com/hashicorp/nomad/client/fingerprint"
|
||||
"github.com/hashicorp/nomad/command/agent/consul"
|
||||
"github.com/hashicorp/nomad/helper"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/mitchellh/go-testing-interface"
|
||||
)
|
||||
|
||||
// TestClient creates an in-memory client for testing purposes.
|
||||
func TestClient(t testing.T, cb func(c *config.Config)) *Client {
|
||||
conf := config.DefaultConfig()
|
||||
conf.VaultConfig.Enabled = helper.BoolToPtr(false)
|
||||
conf.DevMode = true
|
||||
conf.Node = &structs.Node{
|
||||
Reserved: &structs.Resources{
|
||||
DiskMB: 0,
|
||||
},
|
||||
}
|
||||
|
||||
// Tighten the fingerprinter timeouts
|
||||
if conf.Options == nil {
|
||||
conf.Options = make(map[string]string)
|
||||
}
|
||||
conf.Options[fingerprint.TightenNetworkTimeoutsConfig] = "true"
|
||||
|
||||
if cb != nil {
|
||||
cb(conf)
|
||||
}
|
||||
|
||||
logger := testlog.Logger(t)
|
||||
catalog := consul.NewMockCatalog(logger)
|
||||
mockService := newMockConsulServiceClient()
|
||||
mockService.logger = logger
|
||||
client, err := NewClient(conf, catalog, mockService, logger)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
return client
|
||||
}
|
|
@ -19,7 +19,7 @@ import (
|
|||
|
||||
func TestACLEndpoint_GetPolicy(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -74,7 +74,7 @@ func TestACLEndpoint_GetPolicy(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetPolicy_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -153,7 +153,7 @@ func TestACLEndpoint_GetPolicy_Blocking(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetPolicies(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -192,7 +192,7 @@ func TestACLEndpoint_GetPolicies(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetPolicies_TokenSubset(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, _ := testACLServer(t, nil)
|
||||
s1, _ := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -232,7 +232,7 @@ func TestACLEndpoint_GetPolicies_TokenSubset(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetPolicies_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -312,7 +312,7 @@ func TestACLEndpoint_GetPolicies_Blocking(t *testing.T) {
|
|||
func TestACLEndpoint_ListPolicies(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -378,7 +378,7 @@ func TestACLEndpoint_ListPolicies(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_ListPolicies_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -438,7 +438,7 @@ func TestACLEndpoint_ListPolicies_Blocking(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_DeletePolicies(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -464,7 +464,7 @@ func TestACLEndpoint_DeletePolicies(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_UpsertPolicies(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -494,7 +494,7 @@ func TestACLEndpoint_UpsertPolicies(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_UpsertPolicies_Invalid(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -521,7 +521,7 @@ func TestACLEndpoint_UpsertPolicies_Invalid(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetToken(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -566,7 +566,7 @@ func TestACLEndpoint_GetToken(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetToken_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -645,7 +645,7 @@ func TestACLEndpoint_GetToken_Blocking(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetTokens(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -683,7 +683,7 @@ func TestACLEndpoint_GetTokens(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_GetTokens_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -762,7 +762,7 @@ func TestACLEndpoint_GetTokens_Blocking(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_ListTokens(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -823,7 +823,7 @@ func TestACLEndpoint_ListTokens(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_ListTokens_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -883,7 +883,7 @@ func TestACLEndpoint_ListTokens_Blocking(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_DeleteTokens(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -911,7 +911,7 @@ func TestACLEndpoint_DeleteTokens_WithNonexistantToken(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -936,7 +936,7 @@ func TestACLEndpoint_DeleteTokens_WithNonexistantToken(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_Bootstrap(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -973,7 +973,7 @@ func TestACLEndpoint_Bootstrap_Reset(t *testing.T) {
|
|||
t.Parallel()
|
||||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.ACLEnabled = true
|
||||
c.DataDir = dir
|
||||
c.DevMode = false
|
||||
|
@ -1035,7 +1035,7 @@ func TestACLEndpoint_Bootstrap_Reset(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_UpsertTokens(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1091,7 +1091,7 @@ func TestACLEndpoint_UpsertTokens(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_UpsertTokens_Invalid(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1118,7 +1118,7 @@ func TestACLEndpoint_UpsertTokens_Invalid(t *testing.T) {
|
|||
|
||||
func TestACLEndpoint_ResolveToken(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, _ := testACLServer(t, nil)
|
||||
s1, _ := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
|
|
@ -95,7 +95,7 @@ func TestResolveACLToken(t *testing.T) {
|
|||
func TestResolveACLToken_LeaderToken(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
s1, _ := testACLServer(t, nil)
|
||||
s1, _ := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
func TestAllocEndpoint_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -82,7 +82,7 @@ func TestAllocEndpoint_List(t *testing.T) {
|
|||
|
||||
func TestAllocEndpoint_List_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -138,7 +138,7 @@ func TestAllocEndpoint_List_ACL(t *testing.T) {
|
|||
|
||||
func TestAllocEndpoint_List_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -213,7 +213,7 @@ func TestAllocEndpoint_List_Blocking(t *testing.T) {
|
|||
|
||||
func TestAllocEndpoint_GetAlloc(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -253,7 +253,7 @@ func TestAllocEndpoint_GetAlloc(t *testing.T) {
|
|||
|
||||
func TestAllocEndpoint_GetAlloc_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -327,7 +327,7 @@ func TestAllocEndpoint_GetAlloc_ACL(t *testing.T) {
|
|||
|
||||
func TestAllocEndpoint_GetAlloc_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -382,7 +382,7 @@ func TestAllocEndpoint_GetAlloc_Blocking(t *testing.T) {
|
|||
|
||||
func TestAllocEndpoint_GetAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -429,7 +429,7 @@ func TestAllocEndpoint_GetAllocs(t *testing.T) {
|
|||
|
||||
func TestAllocEndpoint_GetAllocs_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
|
|
@ -77,26 +77,26 @@ func testCleanupDeadServer(t *testing.T, raftVersion int) {
|
|||
c.BootstrapExpect = 3
|
||||
c.RaftConfig.ProtocolVersion = raft.ProtocolVersion(raftVersion)
|
||||
}
|
||||
s1 := testServer(t, conf)
|
||||
s1 := TestServer(t, conf)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, conf)
|
||||
s2 := TestServer(t, conf)
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, conf)
|
||||
s3 := TestServer(t, conf)
|
||||
defer s3.Shutdown()
|
||||
|
||||
servers := []*Server{s1, s2, s3}
|
||||
|
||||
// Try to join
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
retry.Run(t, func(r *retry.R) { r.Check(wantPeers(s, 3)) })
|
||||
}
|
||||
|
||||
// Bring up a new server
|
||||
s4 := testServer(t, conf)
|
||||
s4 := TestServer(t, conf)
|
||||
defer s4.Shutdown()
|
||||
|
||||
// Kill a non-leader server
|
||||
|
@ -114,7 +114,7 @@ func testCleanupDeadServer(t *testing.T, raftVersion int) {
|
|||
})
|
||||
|
||||
// Join the new server
|
||||
testJoin(t, s1, s4)
|
||||
TestJoin(t, s1, s4)
|
||||
servers[2] = s4
|
||||
|
||||
// Make sure the dead server is removed and we're back to 3 total peers
|
||||
|
@ -125,30 +125,30 @@ func testCleanupDeadServer(t *testing.T, raftVersion int) {
|
|||
|
||||
func TestAutopilot_CleanupDeadServerPeriodic(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
conf := func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
}
|
||||
|
||||
s2 := testServer(t, conf)
|
||||
s2 := TestServer(t, conf)
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, conf)
|
||||
s3 := TestServer(t, conf)
|
||||
defer s3.Shutdown()
|
||||
|
||||
s4 := testServer(t, conf)
|
||||
s4 := TestServer(t, conf)
|
||||
defer s4.Shutdown()
|
||||
|
||||
s5 := testServer(t, conf)
|
||||
s5 := TestServer(t, conf)
|
||||
defer s5.Shutdown()
|
||||
|
||||
servers := []*Server{s1, s2, s3, s4, s5}
|
||||
|
||||
// Join the servers to s1, and wait until they are all promoted to
|
||||
// voters.
|
||||
testJoin(t, s1, servers[1:]...)
|
||||
TestJoin(t, s1, servers[1:]...)
|
||||
retry.Run(t, func(r *retry.R) {
|
||||
r.Check(wantRaft(servers))
|
||||
for _, s := range servers {
|
||||
|
@ -171,7 +171,7 @@ func TestAutopilot_CleanupDeadServerPeriodic(t *testing.T) {
|
|||
|
||||
func TestAutopilot_RollingUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -181,16 +181,16 @@ func TestAutopilot_RollingUpdate(t *testing.T) {
|
|||
c.RaftConfig.ProtocolVersion = 3
|
||||
}
|
||||
|
||||
s2 := testServer(t, conf)
|
||||
s2 := TestServer(t, conf)
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, conf)
|
||||
s3 := TestServer(t, conf)
|
||||
defer s3.Shutdown()
|
||||
|
||||
// Join the servers to s1, and wait until they are all promoted to
|
||||
// voters.
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
retry.Run(t, func(r *retry.R) {
|
||||
r.Check(wantRaft(servers))
|
||||
for _, s := range servers {
|
||||
|
@ -199,9 +199,9 @@ func TestAutopilot_RollingUpdate(t *testing.T) {
|
|||
})
|
||||
|
||||
// Add one more server like we are doing a rolling update.
|
||||
s4 := testServer(t, conf)
|
||||
s4 := TestServer(t, conf)
|
||||
defer s4.Shutdown()
|
||||
testJoin(t, s1, s4)
|
||||
TestJoin(t, s1, s4)
|
||||
servers = append(servers, s4)
|
||||
retry.Run(t, func(r *retry.R) {
|
||||
r.Check(wantRaft(servers))
|
||||
|
@ -243,25 +243,25 @@ func TestAutopilot_RollingUpdate(t *testing.T) {
|
|||
|
||||
func TestAutopilot_CleanupStaleRaftServer(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
conf := func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
}
|
||||
s2 := testServer(t, conf)
|
||||
s2 := TestServer(t, conf)
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, conf)
|
||||
s3 := TestServer(t, conf)
|
||||
defer s3.Shutdown()
|
||||
|
||||
s4 := testServer(t, conf)
|
||||
s4 := TestServer(t, conf)
|
||||
defer s4.Shutdown()
|
||||
|
||||
servers := []*Server{s1, s2, s3}
|
||||
|
||||
// Join the servers to s1
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
retry.Run(t, func(r *retry.R) { r.Check(wantPeers(s, 3)) })
|
||||
|
@ -293,7 +293,7 @@ func TestAutopilot_CleanupStaleRaftServer(t *testing.T) {
|
|||
|
||||
func TestAutopilot_PromoteNonVoter(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -301,12 +301,12 @@ func TestAutopilot_PromoteNonVoter(t *testing.T) {
|
|||
defer codec.Close()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
|
||||
// Make sure we see it as a nonvoter initially. We wait until half
|
||||
// the stabilization period has passed.
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
func TestCoreScheduler_EvalGC(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
require := require.New(t)
|
||||
|
@ -109,7 +109,7 @@ func TestCoreScheduler_EvalGC(t *testing.T) {
|
|||
// Tests GC behavior on allocations being rescheduled
|
||||
func TestCoreScheduler_EvalGC_ReshedulingAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
require := require.New(t)
|
||||
|
@ -210,7 +210,7 @@ func TestCoreScheduler_EvalGC_ReshedulingAllocs(t *testing.T) {
|
|||
// Tests GC behavior on stopped job with reschedulable allocs
|
||||
func TestCoreScheduler_EvalGC_StoppedJob_Reschedulable(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
require := require.New(t)
|
||||
|
@ -285,7 +285,7 @@ func TestCoreScheduler_EvalGC_StoppedJob_Reschedulable(t *testing.T) {
|
|||
// An EvalGC should never reap a batch job that has not been stopped
|
||||
func TestCoreScheduler_EvalGC_Batch(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -386,7 +386,7 @@ func TestCoreScheduler_EvalGC_Batch(t *testing.T) {
|
|||
// An EvalGC should reap a batch job that has been stopped
|
||||
func TestCoreScheduler_EvalGC_BatchStopped(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -482,7 +482,7 @@ func TestCoreScheduler_EvalGC_BatchStopped(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_EvalGC_Partial(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
require := require.New(t)
|
||||
|
@ -603,9 +603,9 @@ func TestCoreScheduler_EvalGC_Force(t *testing.T) {
|
|||
require := require.New(t)
|
||||
var server *Server
|
||||
if withAcl {
|
||||
server, _ = testACLServer(t, nil)
|
||||
server, _ = TestACLServer(t, nil)
|
||||
} else {
|
||||
server = testServer(t, nil)
|
||||
server = TestServer(t, nil)
|
||||
}
|
||||
defer server.Shutdown()
|
||||
testutil.WaitForLeader(t, server.RPC)
|
||||
|
@ -685,9 +685,9 @@ func TestCoreScheduler_NodeGC(t *testing.T) {
|
|||
t.Run(fmt.Sprintf("with acl %v", withAcl), func(t *testing.T) {
|
||||
var server *Server
|
||||
if withAcl {
|
||||
server, _ = testACLServer(t, nil)
|
||||
server, _ = TestACLServer(t, nil)
|
||||
} else {
|
||||
server = testServer(t, nil)
|
||||
server = TestServer(t, nil)
|
||||
}
|
||||
defer server.Shutdown()
|
||||
testutil.WaitForLeader(t, server.RPC)
|
||||
|
@ -737,7 +737,7 @@ func TestCoreScheduler_NodeGC(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_NodeGC_TerminalAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -792,7 +792,7 @@ func TestCoreScheduler_NodeGC_TerminalAllocs(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_NodeGC_RunningAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -849,7 +849,7 @@ func TestCoreScheduler_NodeGC_RunningAllocs(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_NodeGC_Force(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -892,7 +892,7 @@ func TestCoreScheduler_NodeGC_Force(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_JobGC_OutstandingEvals(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1015,7 +1015,7 @@ func TestCoreScheduler_JobGC_OutstandingEvals(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_JobGC_OutstandingAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ func TestCoreScheduler_JobGC_OutstandingAllocs(t *testing.T) {
|
|||
// allocs/evals and job or nothing
|
||||
func TestCoreScheduler_JobGC_OneShot(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1272,7 +1272,7 @@ func TestCoreScheduler_JobGC_OneShot(t *testing.T) {
|
|||
// This test ensures that stopped jobs are GCd
|
||||
func TestCoreScheduler_JobGC_Stopped(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1376,9 +1376,9 @@ func TestCoreScheduler_JobGC_Force(t *testing.T) {
|
|||
t.Run(fmt.Sprintf("with acl %v", withAcl), func(t *testing.T) {
|
||||
var server *Server
|
||||
if withAcl {
|
||||
server, _ = testACLServer(t, nil)
|
||||
server, _ = TestACLServer(t, nil)
|
||||
} else {
|
||||
server = testServer(t, nil)
|
||||
server = TestServer(t, nil)
|
||||
}
|
||||
defer server.Shutdown()
|
||||
testutil.WaitForLeader(t, server.RPC)
|
||||
|
@ -1443,7 +1443,7 @@ func TestCoreScheduler_JobGC_Force(t *testing.T) {
|
|||
// This test ensures parameterized jobs only get gc'd when stopped
|
||||
func TestCoreScheduler_JobGC_Parameterized(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1523,7 +1523,7 @@ func TestCoreScheduler_JobGC_Parameterized(t *testing.T) {
|
|||
func TestCoreScheduler_JobGC_Periodic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1596,7 +1596,7 @@ func TestCoreScheduler_JobGC_Periodic(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_DeploymentGC(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
assert := assert.New(t)
|
||||
|
@ -1650,9 +1650,9 @@ func TestCoreScheduler_DeploymentGC_Force(t *testing.T) {
|
|||
t.Run(fmt.Sprintf("with acl %v", withAcl), func(t *testing.T) {
|
||||
var server *Server
|
||||
if withAcl {
|
||||
server, _ = testACLServer(t, nil)
|
||||
server, _ = TestACLServer(t, nil)
|
||||
} else {
|
||||
server = testServer(t, nil)
|
||||
server = TestServer(t, nil)
|
||||
}
|
||||
defer server.Shutdown()
|
||||
testutil.WaitForLeader(t, server.RPC)
|
||||
|
@ -1691,7 +1691,7 @@ func TestCoreScheduler_DeploymentGC_Force(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_PartitionEvalReap(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1733,7 +1733,7 @@ func TestCoreScheduler_PartitionEvalReap(t *testing.T) {
|
|||
|
||||
func TestCoreScheduler_PartitionDeploymentReap(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
func TestDeploymentEndpoint_GetDeployment(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -47,7 +47,7 @@ func TestDeploymentEndpoint_GetDeployment(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_GetDeployment_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -100,7 +100,7 @@ func TestDeploymentEndpoint_GetDeployment_ACL(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_GetDeployment_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -149,7 +149,7 @@ func TestDeploymentEndpoint_GetDeployment_Blocking(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Fail(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -198,7 +198,7 @@ func TestDeploymentEndpoint_Fail(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Fail_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, _ := testACLServer(t, func(c *Config) {
|
||||
s1, _ := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -273,7 +273,7 @@ func TestDeploymentEndpoint_Fail_ACL(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Fail_Rollback(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -350,7 +350,7 @@ func TestDeploymentEndpoint_Fail_Rollback(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Pause(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -392,7 +392,7 @@ func TestDeploymentEndpoint_Pause(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Pause_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, _ := testACLServer(t, func(c *Config) {
|
||||
s1, _ := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -460,7 +460,7 @@ func TestDeploymentEndpoint_Pause_ACL(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Promote(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -524,7 +524,7 @@ func TestDeploymentEndpoint_Promote(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Promote_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, _ := testACLServer(t, func(c *Config) {
|
||||
s1, _ := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -614,7 +614,7 @@ func TestDeploymentEndpoint_Promote_ACL(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_SetAllocHealth(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -681,7 +681,7 @@ func TestDeploymentEndpoint_SetAllocHealth(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_SetAllocHealth_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, _ := testACLServer(t, func(c *Config) {
|
||||
s1, _ := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -774,7 +774,7 @@ func TestDeploymentEndpoint_SetAllocHealth_ACL(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_SetAllocHealth_Rollback(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -863,7 +863,7 @@ func TestDeploymentEndpoint_SetAllocHealth_Rollback(t *testing.T) {
|
|||
// tests rollback upon alloc health failure to job with identical spec does not succeed
|
||||
func TestDeploymentEndpoint_SetAllocHealth_NoRollback(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -949,7 +949,7 @@ func TestDeploymentEndpoint_SetAllocHealth_NoRollback(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -995,7 +995,7 @@ func TestDeploymentEndpoint_List(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_List_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1063,7 +1063,7 @@ func TestDeploymentEndpoint_List_ACL(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_List_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -1120,7 +1120,7 @@ func TestDeploymentEndpoint_List_Blocking(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Allocations(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1157,7 +1157,7 @@ func TestDeploymentEndpoint_Allocations(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Allocations_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1231,7 +1231,7 @@ func TestDeploymentEndpoint_Allocations_ACL(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Allocations_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -1298,7 +1298,7 @@ func TestDeploymentEndpoint_Allocations_Blocking(t *testing.T) {
|
|||
|
||||
func TestDeploymentEndpoint_Reap(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
|
||||
func TestEvalEndpoint_GetEval(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -62,7 +62,7 @@ func TestEvalEndpoint_GetEval(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_GetEval_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -122,7 +122,7 @@ func TestEvalEndpoint_GetEval_ACL(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_GetEval_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -200,7 +200,7 @@ func TestEvalEndpoint_GetEval_Blocking(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Dequeue(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -242,7 +242,7 @@ func TestEvalEndpoint_Dequeue(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Dequeue_WaitIndex(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -289,7 +289,7 @@ func TestEvalEndpoint_Dequeue_WaitIndex(t *testing.T) {
|
|||
func TestEvalEndpoint_Dequeue_UpdateWaitIndex(t *testing.T) {
|
||||
// test enqueueing an eval, updating a plan result for the same eval and de-queueing the eval
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -355,7 +355,7 @@ func TestEvalEndpoint_Dequeue_UpdateWaitIndex(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Dequeue_Version_Mismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -381,7 +381,7 @@ func TestEvalEndpoint_Dequeue_Version_Mismatch(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Ack(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
|
||||
|
@ -421,7 +421,7 @@ func TestEvalEndpoint_Ack(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Nack(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
// Disable all of the schedulers so we can manually dequeue
|
||||
// evals and check the queue status
|
||||
c.NumSchedulers = 0
|
||||
|
@ -474,7 +474,7 @@ func TestEvalEndpoint_Nack(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Update(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
|
||||
|
@ -522,7 +522,7 @@ func TestEvalEndpoint_Update(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Create(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -574,7 +574,7 @@ func TestEvalEndpoint_Create(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Reap(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -609,7 +609,7 @@ func TestEvalEndpoint_Reap(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -664,7 +664,7 @@ func TestEvalEndpoint_List(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_List_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -729,7 +729,7 @@ func TestEvalEndpoint_List_ACL(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_List_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -795,7 +795,7 @@ func TestEvalEndpoint_List_Blocking(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Allocations(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -833,7 +833,7 @@ func TestEvalEndpoint_Allocations(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Allocations_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -897,7 +897,7 @@ func TestEvalEndpoint_Allocations_ACL(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Allocations_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -952,7 +952,7 @@ func TestEvalEndpoint_Allocations_Blocking(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Reblock_NonExistent(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -988,7 +988,7 @@ func TestEvalEndpoint_Reblock_NonExistent(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Reblock_NonBlocked(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1030,7 +1030,7 @@ func TestEvalEndpoint_Reblock_NonBlocked(t *testing.T) {
|
|||
|
||||
func TestEvalEndpoint_Reblock(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
func TestInitializeHeartbeatTimers(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -40,7 +40,7 @@ func TestInitializeHeartbeatTimers(t *testing.T) {
|
|||
|
||||
func TestResetHeartbeatTimer(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -62,7 +62,7 @@ func TestResetHeartbeatTimer(t *testing.T) {
|
|||
|
||||
func TestResetHeartbeatTimerLocked(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -83,7 +83,7 @@ func TestResetHeartbeatTimerLocked(t *testing.T) {
|
|||
|
||||
func TestResetHeartbeatTimerLocked_Renew(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -122,7 +122,7 @@ func TestResetHeartbeatTimerLocked_Renew(t *testing.T) {
|
|||
|
||||
func TestInvalidateHeartbeat(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -150,7 +150,7 @@ func TestInvalidateHeartbeat(t *testing.T) {
|
|||
|
||||
func TestClearHeartbeatTimer(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -170,7 +170,7 @@ func TestClearHeartbeatTimer(t *testing.T) {
|
|||
|
||||
func TestClearAllHeartbeatTimers(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -192,20 +192,20 @@ func TestClearAllHeartbeatTimers(t *testing.T) {
|
|||
|
||||
func TestServer_HeartbeatTTL_Failover(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
peers, _ := s1.numPeers()
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
|
||||
func TestJobEndpoint_Register(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -100,7 +100,7 @@ func TestJobEndpoint_Register(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -143,7 +143,7 @@ func TestJobEndpoint_Register_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_InvalidNamespace(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -179,7 +179,7 @@ func TestJobEndpoint_Register_InvalidNamespace(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_InvalidDriverConfig(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -212,7 +212,7 @@ func TestJobEndpoint_Register_InvalidDriverConfig(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_Payload(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -245,7 +245,7 @@ func TestJobEndpoint_Register_Payload(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_Existing(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -361,7 +361,7 @@ func TestJobEndpoint_Register_Existing(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_Periodic(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -413,7 +413,7 @@ func TestJobEndpoint_Register_Periodic(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_ParameterizedJob(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -461,7 +461,7 @@ func TestJobEndpoint_Register_ParameterizedJob(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_EnforceIndex(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -590,7 +590,7 @@ func TestJobEndpoint_Register_EnforceIndex(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_Vault_Disabled(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
f := false
|
||||
c.VaultConfig.Enabled = &f
|
||||
|
@ -623,7 +623,7 @@ func TestJobEndpoint_Register_Vault_Disabled(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_Vault_AllowUnauthenticated(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -676,7 +676,7 @@ func TestJobEndpoint_Register_Vault_AllowUnauthenticated(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_Vault_NoToken(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -716,7 +716,7 @@ func TestJobEndpoint_Register_Vault_NoToken(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Register_Vault_Policies(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -857,7 +857,7 @@ func TestJobEndpoint_Register_Vault_Policies(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Revert(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1028,7 +1028,7 @@ func TestJobEndpoint_Revert_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
|
||||
|
@ -1091,7 +1091,7 @@ func TestJobEndpoint_Revert_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Stable(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1156,7 +1156,7 @@ func TestJobEndpoint_Stable_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1221,7 +1221,7 @@ func TestJobEndpoint_Stable_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Evaluate(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1302,7 +1302,7 @@ func TestJobEndpoint_Evaluate_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1372,7 +1372,7 @@ func TestJobEndpoint_Evaluate_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Evaluate_Periodic(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1415,7 +1415,7 @@ func TestJobEndpoint_Evaluate_Periodic(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Evaluate_ParameterizedJob(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1460,7 +1460,7 @@ func TestJobEndpoint_Evaluate_ParameterizedJob(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Deregister(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1607,7 +1607,7 @@ func TestJobEndpoint_Deregister_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1686,7 +1686,7 @@ func TestJobEndpoint_Deregister_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Deregister_NonExistent(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1746,7 +1746,7 @@ func TestJobEndpoint_Deregister_NonExistent(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Deregister_Periodic(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1804,7 +1804,7 @@ func TestJobEndpoint_Deregister_Periodic(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Deregister_ParameterizedJob(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -1864,7 +1864,7 @@ func TestJobEndpoint_Deregister_ParameterizedJob(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_GetJob(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1943,7 +1943,7 @@ func TestJobEndpoint_GetJob_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1999,7 +1999,7 @@ func TestJobEndpoint_GetJob_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_GetJob_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -2075,7 +2075,7 @@ func TestJobEndpoint_GetJob_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_GetJobVersions(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2149,7 +2149,7 @@ func TestJobEndpoint_GetJobVersions_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2214,7 +2214,7 @@ func TestJobEndpoint_GetJobVersions_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_GetJobVersions_Diff(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2310,7 +2310,7 @@ func TestJobEndpoint_GetJobVersions_Diff(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_GetJobVersions_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -2395,7 +2395,7 @@ func TestJobEndpoint_GetJobVersions_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_GetJobSummary(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
|
||||
|
@ -2458,7 +2458,7 @@ func TestJobEndpoint_Summary_ACL(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
|
||||
srv, root := testACLServer(t, func(c *Config) {
|
||||
srv, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer srv.Shutdown()
|
||||
|
@ -2543,7 +2543,7 @@ func TestJobEndpoint_Summary_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_GetJobSummary_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -2636,7 +2636,7 @@ func TestJobEndpoint_GetJobSummary_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_ListJobs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2699,7 +2699,7 @@ func TestJobEndpoint_ListJobs_WithACL(t *testing.T) {
|
|||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
|
||||
srv, root := testACLServer(t, func(c *Config) {
|
||||
srv, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer srv.Shutdown()
|
||||
|
@ -2757,7 +2757,7 @@ func TestJobEndpoint_ListJobs_WithACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_ListJobs_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -2823,7 +2823,7 @@ func TestJobEndpoint_ListJobs_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Allocations(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2866,7 +2866,7 @@ func TestJobEndpoint_Allocations_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2927,7 +2927,7 @@ func TestJobEndpoint_Allocations_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Allocations_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2984,7 +2984,7 @@ func TestJobEndpoint_Allocations_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Evaluations(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3025,7 +3025,7 @@ func TestJobEndpoint_Evaluations_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3084,7 +3084,7 @@ func TestJobEndpoint_Evaluations_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Evaluations_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3139,7 +3139,7 @@ func TestJobEndpoint_Evaluations_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Deployments(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3174,7 +3174,7 @@ func TestJobEndpoint_Deployments_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3234,7 +3234,7 @@ func TestJobEndpoint_Deployments_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Deployments_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3280,7 +3280,7 @@ func TestJobEndpoint_Deployments_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_LatestDeployment(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3318,7 +3318,7 @@ func TestJobEndpoint_LatestDeployment_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3383,7 +3383,7 @@ func TestJobEndpoint_LatestDeployment_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_LatestDeployment_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -3429,7 +3429,7 @@ func TestJobEndpoint_LatestDeployment_Blocking(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Plan_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -3462,7 +3462,7 @@ func TestJobEndpoint_Plan_ACL(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Plan_WithDiff(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -3521,7 +3521,7 @@ func TestJobEndpoint_Plan_WithDiff(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_Plan_NoDiff(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -3580,7 +3580,7 @@ func TestJobEndpoint_Plan_NoDiff(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_ImplicitConstraints_Vault(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -3649,7 +3649,7 @@ func TestJobEndpoint_ImplicitConstraints_Vault(t *testing.T) {
|
|||
|
||||
func TestJobEndpoint_ImplicitConstraints_Signals(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -3814,7 +3814,7 @@ func TestJobEndpoint_ValidateJobUpdate_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -3850,7 +3850,7 @@ func TestJobEndpoint_Dispatch_ACL(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
|
||||
|
@ -4102,7 +4102,7 @@ func TestJobEndpoint_Dispatch(t *testing.T) {
|
|||
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -16,20 +16,20 @@ import (
|
|||
)
|
||||
|
||||
func TestLeader_LeftServer(t *testing.T) {
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
|
@ -76,20 +76,20 @@ func TestLeader_LeftServer(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_LeftLeader(t *testing.T) {
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
|
@ -128,13 +128,13 @@ func TestLeader_LeftLeader(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_MultiBootstrap(t *testing.T) {
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, nil)
|
||||
s2 := TestServer(t, nil)
|
||||
defer s2.Shutdown()
|
||||
servers := []*Server{s1, s2}
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
|
||||
for _, s := range servers {
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
|
@ -155,20 +155,20 @@ func TestLeader_MultiBootstrap(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_PlanQueue_Reset(t *testing.T) {
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
|
@ -227,24 +227,24 @@ func TestLeader_PlanQueue_Reset(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_EvalBroker_Reset(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
for _, s := range servers {
|
||||
|
@ -304,24 +304,24 @@ func TestLeader_EvalBroker_Reset(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_PeriodicDispatcher_Restore_Adds(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
for _, s := range servers {
|
||||
|
@ -411,7 +411,7 @@ func TestLeader_PeriodicDispatcher_Restore_Adds(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_PeriodicDispatcher_Restore_NoEvals(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -467,7 +467,7 @@ func TestLeader_PeriodicDispatcher_Restore_NoEvals(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_PeriodicDispatcher_Restore_Evals(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -524,7 +524,7 @@ func TestLeader_PeriodicDispatcher_Restore_Evals(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_PeriodicDispatch(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EvalGCInterval = 5 * time.Millisecond
|
||||
})
|
||||
|
@ -544,7 +544,7 @@ func TestLeader_PeriodicDispatch(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_ReapFailedEval(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EvalDeliveryLimit = 1
|
||||
})
|
||||
|
@ -615,7 +615,7 @@ func TestLeader_ReapFailedEval(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_ReapDuplicateEval(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -643,7 +643,7 @@ func TestLeader_ReapDuplicateEval(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestLeader_RestoreVaultAccessors(t *testing.T) {
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -672,13 +672,13 @@ func TestLeader_RestoreVaultAccessors(t *testing.T) {
|
|||
|
||||
func TestLeader_ReplicateACLPolicies(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.Region = "region1"
|
||||
c.AuthoritativeRegion = "region1"
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
s2, _ := testACLServer(t, func(c *Config) {
|
||||
s2, _ := TestACLServer(t, func(c *Config) {
|
||||
c.Region = "region2"
|
||||
c.AuthoritativeRegion = "region1"
|
||||
c.ACLEnabled = true
|
||||
|
@ -686,7 +686,7 @@ func TestLeader_ReplicateACLPolicies(t *testing.T) {
|
|||
c.ReplicationToken = root.SecretID
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
testutil.WaitForLeader(t, s2.RPC)
|
||||
|
||||
|
@ -740,13 +740,13 @@ func TestLeader_DiffACLPolicies(t *testing.T) {
|
|||
|
||||
func TestLeader_ReplicateACLTokens(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.Region = "region1"
|
||||
c.AuthoritativeRegion = "region1"
|
||||
c.ACLEnabled = true
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
s2, _ := testACLServer(t, func(c *Config) {
|
||||
s2, _ := TestACLServer(t, func(c *Config) {
|
||||
c.Region = "region2"
|
||||
c.AuthoritativeRegion = "region1"
|
||||
c.ACLEnabled = true
|
||||
|
@ -754,7 +754,7 @@ func TestLeader_ReplicateACLTokens(t *testing.T) {
|
|||
c.ReplicationToken = root.SecretID
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
testutil.WaitForLeader(t, s2.RPC)
|
||||
|
||||
|
@ -815,18 +815,19 @@ func TestLeader_DiffACLTokens(t *testing.T) {
|
|||
|
||||
func TestLeader_UpgradeRaftVersion(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.Datacenter = "dc1"
|
||||
c.RaftConfig.ProtocolVersion = 2
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
c.RaftConfig.ProtocolVersion = 1
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
c.RaftConfig.ProtocolVersion = 2
|
||||
})
|
||||
|
@ -835,7 +836,7 @@ func TestLeader_UpgradeRaftVersion(t *testing.T) {
|
|||
servers := []*Server{s1, s2, s3}
|
||||
|
||||
// Try to join
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
|
@ -862,13 +863,13 @@ func TestLeader_UpgradeRaftVersion(t *testing.T) {
|
|||
}
|
||||
|
||||
// Replace the dead server with one running raft protocol v3
|
||||
s4 := testServer(t, func(c *Config) {
|
||||
s4 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
c.Datacenter = "dc1"
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
defer s4.Shutdown()
|
||||
testJoin(t, s1, s4)
|
||||
TestJoin(t, s1, s4)
|
||||
servers[1] = s4
|
||||
|
||||
// Make sure we're back to 3 total peers with the new one added via ID
|
||||
|
@ -903,18 +904,18 @@ func TestLeader_UpgradeRaftVersion(t *testing.T) {
|
|||
|
||||
func TestLeader_RollRaftServer(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.RaftConfig.ProtocolVersion = 2
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
c.RaftConfig.ProtocolVersion = 1
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
c.RaftConfig.ProtocolVersion = 2
|
||||
})
|
||||
|
@ -923,7 +924,7 @@ func TestLeader_RollRaftServer(t *testing.T) {
|
|||
servers := []*Server{s1, s2, s3}
|
||||
|
||||
// Try to join
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
retry.Run(t, func(r *retry.R) { r.Check(wantPeers(s, 3)) })
|
||||
|
@ -945,12 +946,12 @@ func TestLeader_RollRaftServer(t *testing.T) {
|
|||
}
|
||||
|
||||
// Replace the dead server with one running raft protocol v3
|
||||
s4 := testServer(t, func(c *Config) {
|
||||
s4 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
defer s4.Shutdown()
|
||||
testJoin(t, s4, s1)
|
||||
TestJoin(t, s4, s1)
|
||||
servers[1] = s4
|
||||
|
||||
// Make sure the dead server is removed and we're back to 3 total peers
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
func TestClientEndpoint_Register(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -80,7 +80,7 @@ func TestClientEndpoint_Register(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_Register_SecretMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -108,7 +108,7 @@ func TestClientEndpoint_Register_SecretMismatch(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_Deregister(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -153,7 +153,7 @@ func TestClientEndpoint_Deregister(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_Deregister_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -218,7 +218,7 @@ func TestClientEndpoint_Deregister_ACL(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_Deregister_Vault(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -280,7 +280,7 @@ func TestClientEndpoint_Deregister_Vault(t *testing.T) {
|
|||
func TestClientEndpoint_UpdateStatus(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -358,7 +358,7 @@ func TestClientEndpoint_UpdateStatus(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_UpdateStatus_Vault(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -416,7 +416,7 @@ func TestClientEndpoint_UpdateStatus_Vault(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_Register_GetEvals(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -510,7 +510,7 @@ func TestClientEndpoint_Register_GetEvals(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_UpdateStatus_GetEvals(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -593,20 +593,20 @@ func TestClientEndpoint_UpdateStatus_GetEvals(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_UpdateStatus_HeartbeatOnly(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
servers := []*Server{s1, s2, s3}
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
for _, s := range servers {
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
|
@ -668,7 +668,7 @@ func TestClientEndpoint_UpdateStatus_HeartbeatOnly(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_UpdateDrain(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -714,7 +714,7 @@ func TestClientEndpoint_UpdateDrain(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_UpdateDrain_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -771,7 +771,7 @@ func TestClientEndpoint_UpdateDrain_ACL(t *testing.T) {
|
|||
// pending/running state to lost when a node is marked as down.
|
||||
func TestClientEndpoint_Drain_Down(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -907,7 +907,7 @@ func TestClientEndpoint_Drain_Down(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_GetNode(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -966,7 +966,7 @@ func TestClientEndpoint_GetNode(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_GetNode_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1029,7 +1029,7 @@ func TestClientEndpoint_GetNode_ACL(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_GetNode_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -1131,7 +1131,7 @@ func TestClientEndpoint_GetNode_Blocking(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_GetAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1193,7 +1193,7 @@ func TestClientEndpoint_GetAllocs(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_GetAllocs_ACL_Basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1268,7 +1268,7 @@ func TestClientEndpoint_GetAllocs_ACL_Basic(t *testing.T) {
|
|||
func TestClientEndpoint_GetClientAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1346,7 +1346,7 @@ func TestClientEndpoint_GetClientAllocs(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_GetClientAllocs_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1468,7 +1468,7 @@ func TestClientEndpoint_GetClientAllocs_Blocking(t *testing.T) {
|
|||
func TestClientEndpoint_GetClientAllocs_Blocking_GC(t *testing.T) {
|
||||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1545,7 +1545,7 @@ func TestClientEndpoint_GetClientAllocs_WithoutMigrateTokens(t *testing.T) {
|
|||
t.Parallel()
|
||||
assert := assert.New(t)
|
||||
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1596,7 +1596,7 @@ func TestClientEndpoint_GetClientAllocs_WithoutMigrateTokens(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_GetAllocs_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1688,7 +1688,7 @@ func TestClientEndpoint_GetAllocs_Blocking(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_UpdateAlloc(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1766,7 +1766,7 @@ func TestClientEndpoint_UpdateAlloc(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_BatchUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1823,7 +1823,7 @@ func TestClientEndpoint_BatchUpdate(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_UpdateAlloc_Vault(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -1908,7 +1908,7 @@ func TestClientEndpoint_UpdateAlloc_Vault(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_CreateNodeEvals(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -1996,7 +1996,7 @@ func TestClientEndpoint_CreateNodeEvals(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_Evaluate(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -2077,7 +2077,7 @@ func TestClientEndpoint_Evaluate(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_Evaluate_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2135,7 +2135,7 @@ func TestClientEndpoint_Evaluate_ACL(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_ListNodes(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2196,7 +2196,7 @@ func TestClientEndpoint_ListNodes(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_ListNodes_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -2250,7 +2250,7 @@ func TestClientEndpoint_ListNodes_ACL(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_ListNodes_Blocking(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -2391,7 +2391,7 @@ func TestBatchFuture(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_DeriveVaultToken_Bad(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -2472,7 +2472,7 @@ func TestClientEndpoint_DeriveVaultToken_Bad(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_DeriveVaultToken(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
@ -2564,7 +2564,7 @@ func TestClientEndpoint_DeriveVaultToken(t *testing.T) {
|
|||
|
||||
func TestClientEndpoint_DeriveVaultToken_VaultError(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
state := s1.fsm.State()
|
||||
codec := rpcClient(t, s1)
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
func TestOperator_RaftGetConfiguration(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -61,7 +61,7 @@ func TestOperator_RaftGetConfiguration(t *testing.T) {
|
|||
|
||||
func TestOperator_RaftGetConfiguration_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -124,7 +124,7 @@ func TestOperator_RaftGetConfiguration_ACL(t *testing.T) {
|
|||
|
||||
func TestOperator_RaftRemovePeerByAddress(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -180,7 +180,7 @@ func TestOperator_RaftRemovePeerByAddress(t *testing.T) {
|
|||
|
||||
func TestOperator_RaftRemovePeerByAddress_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -228,7 +228,7 @@ func TestOperator_RaftRemovePeerByAddress_ACL(t *testing.T) {
|
|||
|
||||
func TestOperator_RaftRemovePeerByID(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -286,7 +286,7 @@ func TestOperator_RaftRemovePeerByID(t *testing.T) {
|
|||
|
||||
func TestOperator_RaftRemovePeerByID_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.RaftConfig.ProtocolVersion = 3
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
func TestPeriodicEndpoint_Force(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
state := s1.fsm.State()
|
||||
|
@ -64,7 +64,7 @@ func TestPeriodicEndpoint_Force(t *testing.T) {
|
|||
|
||||
func TestPeriodicEndpoint_Force_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, func(c *Config) {
|
||||
s1, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -142,7 +142,7 @@ func TestPeriodicEndpoint_Force_ACL(t *testing.T) {
|
|||
|
||||
func TestPeriodicEndpoint_Force_NonPeriodic(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0 // Prevent automatic dequeue
|
||||
})
|
||||
state := s1.fsm.State()
|
||||
|
|
|
@ -656,7 +656,7 @@ func deriveChildJob(parent *structs.Job) *structs.Job {
|
|||
|
||||
func TestPeriodicDispatch_RunningChildren_NoEvals(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -679,7 +679,7 @@ func TestPeriodicDispatch_RunningChildren_NoEvals(t *testing.T) {
|
|||
|
||||
func TestPeriodicDispatch_RunningChildren_ActiveEvals(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -715,7 +715,7 @@ func TestPeriodicDispatch_RunningChildren_ActiveEvals(t *testing.T) {
|
|||
|
||||
func TestPeriodicDispatch_RunningChildren_ActiveAllocs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
memdb "github.com/hashicorp/go-memdb"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
"github.com/hashicorp/nomad/helper/uuid"
|
||||
"github.com/hashicorp/nomad/nomad/mock"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
|
@ -62,7 +63,7 @@ func testRegisterJob(t *testing.T, s *Server, j *structs.Job) {
|
|||
|
||||
func TestPlanApply_applyPlan(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
|
@ -252,7 +253,7 @@ func TestPlanApply_EvalPlan_Simple(t *testing.T) {
|
|||
pool := NewEvaluatePool(workerPoolSize, workerPoolBufferSize)
|
||||
defer pool.Shutdown()
|
||||
|
||||
result, err := evaluatePlan(pool, snap, plan, testLogger())
|
||||
result, err := evaluatePlan(pool, snap, plan, testlog.Logger(t))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
@ -299,7 +300,7 @@ func TestPlanApply_EvalPlan_Partial(t *testing.T) {
|
|||
pool := NewEvaluatePool(workerPoolSize, workerPoolBufferSize)
|
||||
defer pool.Shutdown()
|
||||
|
||||
result, err := evaluatePlan(pool, snap, plan, testLogger())
|
||||
result, err := evaluatePlan(pool, snap, plan, testlog.Logger(t))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
@ -360,7 +361,7 @@ func TestPlanApply_EvalPlan_Partial_AllAtOnce(t *testing.T) {
|
|||
pool := NewEvaluatePool(workerPoolSize, workerPoolBufferSize)
|
||||
defer pool.Shutdown()
|
||||
|
||||
result, err := evaluatePlan(pool, snap, plan, testLogger())
|
||||
result, err := evaluatePlan(pool, snap, plan, testlog.Logger(t))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
func TestPlanEndpoint_Submit(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
|
|
@ -18,7 +18,7 @@ func newTestPool(t *testing.T) *ConnPool {
|
|||
|
||||
func TestConnPool_ConnListener(t *testing.T) {
|
||||
// Create a server and test pool
|
||||
s := testServer(t, nil)
|
||||
s := TestServer(t, nil)
|
||||
pool := newTestPool(t)
|
||||
|
||||
// Setup a listener
|
||||
|
|
|
@ -12,13 +12,13 @@ import (
|
|||
func TestRegionList(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Make the servers
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region1"
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region2"
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
|
|
@ -31,13 +31,13 @@ func rpcClient(t *testing.T, s *Server) rpc.ClientCodec {
|
|||
|
||||
func TestRPC_forwardLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
testutil.WaitForLeader(t, s2.RPC)
|
||||
|
||||
|
@ -70,13 +70,13 @@ func TestRPC_forwardLeader(t *testing.T) {
|
|||
|
||||
func TestRPC_forwardRegion(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region2"
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
testutil.WaitForLeader(t, s2.RPC)
|
||||
|
||||
|
@ -104,7 +104,7 @@ func TestRPC_PlaintextRPCSucceedsWhenInUpgradeMode(t *testing.T) {
|
|||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.DataDir = path.Join(dir, "node1")
|
||||
c.TLSConfig = &config.TLSConfig{
|
||||
EnableRPC: true,
|
||||
|
@ -147,7 +147,7 @@ func TestRPC_PlaintextRPCFailsWhenNotInUpgradeMode(t *testing.T) {
|
|||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.DataDir = path.Join(dir, "node1")
|
||||
c.TLSConfig = &config.TLSConfig{
|
||||
EnableRPC: true,
|
||||
|
|
|
@ -31,7 +31,7 @@ func TestSearch_PrefixSearch_Job(t *testing.T) {
|
|||
prefix := "aaaaaaaa-e8f7-fd38-c855-ab94ceb8970"
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -65,7 +65,7 @@ func TestSearch_PrefixSearch_ACL(t *testing.T) {
|
|||
jobID := "aaaaaaaa-e8f7-fd38-c855-ab94ceb8970"
|
||||
|
||||
t.Parallel()
|
||||
s, root := testACLServer(t, func(c *Config) {
|
||||
s, root := TestACLServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -178,7 +178,7 @@ func TestSearch_PrefixSearch_All_JobWithHyphen(t *testing.T) {
|
|||
prefix := "example-test-------" // Assert that a job with more than 4 hyphens works
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -225,7 +225,7 @@ func TestSearch_PrefixSearch_All_LongJob(t *testing.T) {
|
|||
prefix := strings.Repeat("a", 100)
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -272,7 +272,7 @@ func TestSearch_PrefixSearch_Truncate(t *testing.T) {
|
|||
prefix := "aaaaaaaa-e8f7-fd38-c855-ab94ceb8970"
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -309,7 +309,7 @@ func TestSearch_PrefixSearch_AllWithJob(t *testing.T) {
|
|||
prefix := "aaaaaaaa-e8f7-fd38-c855-ab94ceb8970"
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -347,7 +347,7 @@ func TestSearch_PrefixSearch_AllWithJob(t *testing.T) {
|
|||
func TestSearch_PrefixSearch_Evals(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -384,7 +384,7 @@ func TestSearch_PrefixSearch_Evals(t *testing.T) {
|
|||
func TestSearch_PrefixSearch_Allocation(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -429,7 +429,7 @@ func TestSearch_PrefixSearch_Allocation(t *testing.T) {
|
|||
func TestSearch_PrefixSearch_All_UUID(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -481,7 +481,7 @@ func TestSearch_PrefixSearch_All_UUID(t *testing.T) {
|
|||
func TestSearch_PrefixSearch_Node(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -522,7 +522,7 @@ func TestSearch_PrefixSearch_Node(t *testing.T) {
|
|||
func TestSearch_PrefixSearch_Deployment(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -559,7 +559,7 @@ func TestSearch_PrefixSearch_Deployment(t *testing.T) {
|
|||
func TestSearch_PrefixSearch_AllContext(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -612,7 +612,7 @@ func TestSearch_PrefixSearch_NoPrefix(t *testing.T) {
|
|||
prefix := "aaaaaaaa-e8f7-fd38-c855-ab94ceb8970"
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -649,7 +649,7 @@ func TestSearch_PrefixSearch_NoMatches(t *testing.T) {
|
|||
prefix := "aaaaaaaa-e8f7-fd38-c855-ab94ceb8970"
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -684,7 +684,7 @@ func TestSearch_PrefixSearch_RoundDownToEven(t *testing.T) {
|
|||
prefix := "aaafa"
|
||||
|
||||
t.Parallel()
|
||||
s := testServer(t, func(c *Config) {
|
||||
s := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
})
|
||||
|
||||
|
@ -719,19 +719,19 @@ func TestSearch_PrefixSearch_MultiRegion(t *testing.T) {
|
|||
jobName := "exampleexample"
|
||||
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.Region = "foo"
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.Region = "bar"
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
job := registerAndVerifyJob(s1, t, jobName, 0)
|
||||
|
|
|
@ -14,13 +14,13 @@ import (
|
|||
|
||||
func TestNomad_JoinPeer(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region2"
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
if members := s1.Members(); len(members) != 2 {
|
||||
|
@ -55,13 +55,13 @@ func TestNomad_JoinPeer(t *testing.T) {
|
|||
|
||||
func TestNomad_RemovePeer(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region2"
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
if members := s1.Members(); len(members) != 2 {
|
||||
|
@ -96,7 +96,7 @@ func TestNomad_ReapPeer(t *testing.T) {
|
|||
t.Parallel()
|
||||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NodeName = "node1"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -104,7 +104,7 @@ func TestNomad_ReapPeer(t *testing.T) {
|
|||
c.DataDir = path.Join(dir, "node1")
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.NodeName = "node2"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -112,7 +112,7 @@ func TestNomad_ReapPeer(t *testing.T) {
|
|||
c.DataDir = path.Join(dir, "node2")
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.NodeName = "node3"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -120,11 +120,11 @@ func TestNomad_ReapPeer(t *testing.T) {
|
|||
c.DataDir = path.Join(dir, "node3")
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
// Retry the join to decrease flakiness
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
if members := s1.Members(); len(members) != 3 {
|
||||
return false, fmt.Errorf("bad s1: %#v", members)
|
||||
}
|
||||
|
@ -191,32 +191,32 @@ func TestNomad_BootstrapExpect(t *testing.T) {
|
|||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
c.DevDisableBootstrap = true
|
||||
c.DataDir = path.Join(dir, "node1")
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
c.DevDisableBootstrap = true
|
||||
c.DataDir = path.Join(dir, "node2")
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
c.DevDisableBootstrap = true
|
||||
c.DataDir = path.Join(dir, "node3")
|
||||
})
|
||||
defer s3.Shutdown()
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
// Retry the join to decrease flakiness
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
peers, err := s1.numPeers()
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
@ -254,7 +254,7 @@ func TestNomad_BootstrapExpect(t *testing.T) {
|
|||
|
||||
// Join a fourth server after quorum has already been formed and ensure
|
||||
// there is no election
|
||||
s4 := testServer(t, func(c *Config) {
|
||||
s4 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
c.DevDisableBootstrap = true
|
||||
|
@ -300,18 +300,18 @@ func TestNomad_BootstrapExpect(t *testing.T) {
|
|||
|
||||
func TestNomad_BadExpect(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 2
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 3
|
||||
c.DevDisableBootstrap = true
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
servers := []*Server{s1, s2}
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
|
||||
// Serf members should update
|
||||
testutil.WaitForResult(func() (bool, error) {
|
||||
|
|
|
@ -3,19 +3,13 @@ package nomad
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/lib/freeport"
|
||||
msgpackrpc "github.com/hashicorp/net-rpc-msgpackrpc"
|
||||
"github.com/hashicorp/nomad/command/agent/consul"
|
||||
"github.com/hashicorp/nomad/helper/uuid"
|
||||
"github.com/hashicorp/nomad/nomad/mock"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
|
@ -24,15 +18,8 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var (
|
||||
nodeNumber uint32 = 0
|
||||
)
|
||||
|
||||
func testLogger() *log.Logger {
|
||||
return log.New(os.Stderr, "", log.LstdFlags)
|
||||
}
|
||||
|
||||
func tmpDir(t *testing.T) string {
|
||||
t.Helper()
|
||||
dir, err := ioutil.TempDir("", "nomad")
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
|
@ -40,110 +27,9 @@ func tmpDir(t *testing.T) string {
|
|||
return dir
|
||||
}
|
||||
|
||||
func testACLServer(t *testing.T, cb func(*Config)) (*Server, *structs.ACLToken) {
|
||||
server := testServer(t, func(c *Config) {
|
||||
c.ACLEnabled = true
|
||||
if cb != nil {
|
||||
cb(c)
|
||||
}
|
||||
})
|
||||
token := mock.ACLManagementToken()
|
||||
err := server.State().BootstrapACLTokens(1, 0, token)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to bootstrap ACL token: %v", err)
|
||||
}
|
||||
return server, token
|
||||
}
|
||||
|
||||
func testServer(t *testing.T, cb func(*Config)) *Server {
|
||||
// Setup the default settings
|
||||
config := DefaultConfig()
|
||||
config.Build = "0.8.0+unittest"
|
||||
config.DevMode = true
|
||||
nodeNum := atomic.AddUint32(&nodeNumber, 1)
|
||||
config.NodeName = fmt.Sprintf("nomad-%03d", nodeNum)
|
||||
|
||||
// Tighten the Serf timing
|
||||
config.SerfConfig.MemberlistConfig.BindAddr = "127.0.0.1"
|
||||
config.SerfConfig.MemberlistConfig.SuspicionMult = 2
|
||||
config.SerfConfig.MemberlistConfig.RetransmitMult = 2
|
||||
config.SerfConfig.MemberlistConfig.ProbeTimeout = 50 * time.Millisecond
|
||||
config.SerfConfig.MemberlistConfig.ProbeInterval = 100 * time.Millisecond
|
||||
config.SerfConfig.MemberlistConfig.GossipInterval = 100 * time.Millisecond
|
||||
|
||||
// Tighten the Raft timing
|
||||
config.RaftConfig.LeaderLeaseTimeout = 50 * time.Millisecond
|
||||
config.RaftConfig.HeartbeatTimeout = 50 * time.Millisecond
|
||||
config.RaftConfig.ElectionTimeout = 50 * time.Millisecond
|
||||
config.RaftTimeout = 500 * time.Millisecond
|
||||
|
||||
// Tighten the autopilot timing
|
||||
config.AutopilotConfig.ServerStabilizationTime = 100 * time.Millisecond
|
||||
config.ServerHealthInterval = 50 * time.Millisecond
|
||||
config.AutopilotInterval = 100 * time.Millisecond
|
||||
|
||||
// Disable Vault
|
||||
f := false
|
||||
config.VaultConfig.Enabled = &f
|
||||
|
||||
// Squelch output when -v isn't specified
|
||||
if !testing.Verbose() {
|
||||
config.LogOutput = ioutil.Discard
|
||||
}
|
||||
|
||||
// Invoke the callback if any
|
||||
if cb != nil {
|
||||
cb(config)
|
||||
}
|
||||
|
||||
// Enable raft as leader if we have bootstrap on
|
||||
config.RaftConfig.StartAsLeader = !config.DevDisableBootstrap
|
||||
|
||||
logger := log.New(config.LogOutput, fmt.Sprintf("[%s] ", config.NodeName), log.LstdFlags)
|
||||
catalog := consul.NewMockCatalog(logger)
|
||||
|
||||
for i := 10; i >= 0; i-- {
|
||||
// Get random ports
|
||||
ports := freeport.GetT(t, 2)
|
||||
config.RPCAddr = &net.TCPAddr{
|
||||
IP: []byte{127, 0, 0, 1},
|
||||
Port: ports[0],
|
||||
}
|
||||
config.SerfConfig.MemberlistConfig.BindPort = ports[1]
|
||||
|
||||
// Create server
|
||||
server, err := NewServer(config, catalog, logger)
|
||||
if err == nil {
|
||||
return server
|
||||
} else if i == 0 {
|
||||
t.Fatalf("err: %v", err)
|
||||
} else {
|
||||
if server != nil {
|
||||
server.Shutdown()
|
||||
}
|
||||
wait := time.Duration(rand.Int31n(2000)) * time.Millisecond
|
||||
time.Sleep(wait)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testJoin(t *testing.T, s1 *Server, other ...*Server) {
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfConfig.MemberlistConfig.BindPort)
|
||||
for _, s2 := range other {
|
||||
if num, err := s2.Join([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
} else if num != 1 {
|
||||
t.Fatalf("bad: %d", num)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestServer_RPC(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
|
||||
var out struct{}
|
||||
|
@ -161,7 +47,7 @@ func TestServer_RPC_TLS(t *testing.T) {
|
|||
)
|
||||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.Region = "regionFoo"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -178,7 +64,7 @@ func TestServer_RPC_TLS(t *testing.T) {
|
|||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.Region = "regionFoo"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -194,7 +80,7 @@ func TestServer_RPC_TLS(t *testing.T) {
|
|||
}
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.Region = "regionFoo"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -211,7 +97,7 @@ func TestServer_RPC_TLS(t *testing.T) {
|
|||
})
|
||||
defer s3.Shutdown()
|
||||
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
// Part of a server joining is making an RPC request, so just by testing
|
||||
|
@ -227,7 +113,7 @@ func TestServer_RPC_MixedTLS(t *testing.T) {
|
|||
)
|
||||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.Region = "regionFoo"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -244,7 +130,7 @@ func TestServer_RPC_MixedTLS(t *testing.T) {
|
|||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.Region = "regionFoo"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -260,7 +146,7 @@ func TestServer_RPC_MixedTLS(t *testing.T) {
|
|||
}
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
s3 := testServer(t, func(c *Config) {
|
||||
s3 := TestServer(t, func(c *Config) {
|
||||
c.Region = "regionFoo"
|
||||
c.BootstrapExpect = 3
|
||||
c.DevMode = false
|
||||
|
@ -269,7 +155,7 @@ func TestServer_RPC_MixedTLS(t *testing.T) {
|
|||
})
|
||||
defer s3.Shutdown()
|
||||
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
|
||||
// Ensure that we do not form a quorum
|
||||
start := time.Now()
|
||||
|
@ -290,12 +176,12 @@ func TestServer_RPC_MixedTLS(t *testing.T) {
|
|||
func TestServer_Regions(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Make the servers
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region1"
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region2"
|
||||
})
|
||||
defer s2.Shutdown()
|
||||
|
@ -321,7 +207,7 @@ func TestServer_Regions(t *testing.T) {
|
|||
|
||||
func TestServer_Reload_Vault(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.Region = "region1"
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -362,7 +248,7 @@ func TestServer_Reload_TLSConnections_PlaintextToTLS(t *testing.T) {
|
|||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.DataDir = path.Join(dir, "nodeA")
|
||||
})
|
||||
defer s1.Shutdown()
|
||||
|
@ -412,7 +298,7 @@ func TestServer_Reload_TLSConnections_TLSToPlaintext_RPC(t *testing.T) {
|
|||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.DataDir = path.Join(dir, "nodeB")
|
||||
c.TLSConfig = &config.TLSConfig{
|
||||
EnableHTTP: true,
|
||||
|
@ -459,7 +345,7 @@ func TestServer_Reload_TLSConnections_Raft(t *testing.T) {
|
|||
dir := tmpDir(t)
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 2
|
||||
c.DevMode = false
|
||||
c.DevDisableBootstrap = true
|
||||
|
@ -469,7 +355,7 @@ func TestServer_Reload_TLSConnections_Raft(t *testing.T) {
|
|||
})
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, func(c *Config) {
|
||||
s2 := TestServer(t, func(c *Config) {
|
||||
c.BootstrapExpect = 2
|
||||
c.DevMode = false
|
||||
c.DevDisableBootstrap = true
|
||||
|
@ -479,7 +365,7 @@ func TestServer_Reload_TLSConnections_Raft(t *testing.T) {
|
|||
})
|
||||
defer s2.Shutdown()
|
||||
|
||||
testJoin(t, s1, s2)
|
||||
TestJoin(t, s1, s2)
|
||||
servers := []*Server{s1, s2}
|
||||
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
|
|
@ -17,16 +17,16 @@ func TestStatsFetcher(t *testing.T) {
|
|||
c.BootstrapExpect = 3
|
||||
}
|
||||
|
||||
s1 := testServer(t, conf)
|
||||
s1 := TestServer(t, conf)
|
||||
defer s1.Shutdown()
|
||||
|
||||
s2 := testServer(t, conf)
|
||||
s2 := TestServer(t, conf)
|
||||
defer s2.Shutdown()
|
||||
|
||||
s3 := testServer(t, conf)
|
||||
s3 := TestServer(t, conf)
|
||||
defer s3.Shutdown()
|
||||
|
||||
testJoin(t, s1, s2, s3)
|
||||
TestJoin(t, s1, s2, s3)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
||||
members := s1.serf.Members()
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func TestStatusVersion(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
|
||||
|
@ -44,7 +44,7 @@ func TestStatusVersion(t *testing.T) {
|
|||
|
||||
func TestStatusPing(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
|
||||
|
@ -57,7 +57,7 @@ func TestStatusPing(t *testing.T) {
|
|||
|
||||
func TestStatusLeader(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -79,7 +79,7 @@ func TestStatusLeader(t *testing.T) {
|
|||
|
||||
func TestStatusPeers(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
|
||||
|
@ -100,7 +100,7 @@ func TestStatusPeers(t *testing.T) {
|
|||
|
||||
func TestStatusMembers(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
assert := assert.New(t)
|
||||
|
@ -119,7 +119,7 @@ func TestStatusMembers(t *testing.T) {
|
|||
|
||||
func TestStatusMembers_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
assert := assert.New(t)
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
|
||||
func TestSystemEndpoint_GarbageCollect(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -66,7 +66,7 @@ func TestSystemEndpoint_GarbageCollect(t *testing.T) {
|
|||
|
||||
func TestSystemEndpoint_GarbageCollect_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
assert := assert.New(t)
|
||||
|
@ -110,7 +110,7 @@ func TestSystemEndpoint_GarbageCollect_ACL(t *testing.T) {
|
|||
|
||||
func TestSystemEndpoint_ReconcileSummaries(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, nil)
|
||||
s1 := TestServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
testutil.WaitForLeader(t, s1.RPC)
|
||||
|
@ -172,7 +172,7 @@ func TestSystemEndpoint_ReconcileSummaries(t *testing.T) {
|
|||
|
||||
func TestSystemEndpoint_ReconcileJobSummaries_ACL(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1, root := testACLServer(t, nil)
|
||||
s1, root := TestACLServer(t, nil)
|
||||
defer s1.Shutdown()
|
||||
codec := rpcClient(t, s1)
|
||||
assert := assert.New(t)
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
package nomad
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/lib/freeport"
|
||||
"github.com/hashicorp/nomad/command/agent/consul"
|
||||
"github.com/hashicorp/nomad/helper/testlog"
|
||||
"github.com/hashicorp/nomad/nomad/mock"
|
||||
"github.com/hashicorp/nomad/nomad/structs"
|
||||
"github.com/mitchellh/go-testing-interface"
|
||||
)
|
||||
|
||||
var (
|
||||
nodeNumber uint32 = 0
|
||||
)
|
||||
|
||||
func TestACLServer(t testing.T, cb func(*Config)) (*Server, *structs.ACLToken) {
|
||||
server := TestServer(t, func(c *Config) {
|
||||
c.ACLEnabled = true
|
||||
if cb != nil {
|
||||
cb(c)
|
||||
}
|
||||
})
|
||||
token := mock.ACLManagementToken()
|
||||
err := server.State().BootstrapACLTokens(1, 0, token)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to bootstrap ACL token: %v", err)
|
||||
}
|
||||
return server, token
|
||||
}
|
||||
|
||||
func TestServer(t testing.T, cb func(*Config)) *Server {
|
||||
// Setup the default settings
|
||||
config := DefaultConfig()
|
||||
config.Build = "0.7.0+unittest"
|
||||
config.DevMode = true
|
||||
nodeNum := atomic.AddUint32(&nodeNumber, 1)
|
||||
config.NodeName = fmt.Sprintf("nomad-%03d", nodeNum)
|
||||
|
||||
// Tighten the Serf timing
|
||||
config.SerfConfig.MemberlistConfig.BindAddr = "127.0.0.1"
|
||||
config.SerfConfig.MemberlistConfig.SuspicionMult = 2
|
||||
config.SerfConfig.MemberlistConfig.RetransmitMult = 2
|
||||
config.SerfConfig.MemberlistConfig.ProbeTimeout = 50 * time.Millisecond
|
||||
config.SerfConfig.MemberlistConfig.ProbeInterval = 100 * time.Millisecond
|
||||
config.SerfConfig.MemberlistConfig.GossipInterval = 100 * time.Millisecond
|
||||
|
||||
// Tighten the Raft timing
|
||||
config.RaftConfig.LeaderLeaseTimeout = 50 * time.Millisecond
|
||||
config.RaftConfig.HeartbeatTimeout = 50 * time.Millisecond
|
||||
config.RaftConfig.ElectionTimeout = 50 * time.Millisecond
|
||||
config.RaftTimeout = 500 * time.Millisecond
|
||||
|
||||
// Disable Vault
|
||||
f := false
|
||||
config.VaultConfig.Enabled = &f
|
||||
|
||||
// Squelch output when -v isn't specified
|
||||
config.LogOutput = testlog.NewWriter(t)
|
||||
|
||||
// Invoke the callback if any
|
||||
if cb != nil {
|
||||
cb(config)
|
||||
}
|
||||
|
||||
// Enable raft as leader if we have bootstrap on
|
||||
config.RaftConfig.StartAsLeader = !config.DevDisableBootstrap
|
||||
|
||||
logger := log.New(config.LogOutput, fmt.Sprintf("[%s] ", config.NodeName), log.LstdFlags)
|
||||
catalog := consul.NewMockCatalog(logger)
|
||||
|
||||
for i := 10; i >= 0; i-- {
|
||||
// Get random ports
|
||||
ports := freeport.GetT(t, 2)
|
||||
config.RPCAddr = &net.TCPAddr{
|
||||
IP: []byte{127, 0, 0, 1},
|
||||
Port: ports[0],
|
||||
}
|
||||
config.SerfConfig.MemberlistConfig.BindPort = ports[1]
|
||||
|
||||
// Create server
|
||||
server, err := NewServer(config, catalog, logger)
|
||||
if err == nil {
|
||||
return server
|
||||
} else if i == 0 {
|
||||
t.Fatalf("err: %v", err)
|
||||
} else {
|
||||
if server != nil {
|
||||
server.Shutdown()
|
||||
}
|
||||
wait := time.Duration(rand.Int31n(2000)) * time.Millisecond
|
||||
time.Sleep(wait)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestJoin(t testing.T, s1 *Server, other ...*Server) {
|
||||
addr := fmt.Sprintf("127.0.0.1:%d",
|
||||
s1.config.SerfConfig.MemberlistConfig.BindPort)
|
||||
for _, s2 := range other {
|
||||
if num, err := s2.Join([]string{addr}); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
} else if num != 1 {
|
||||
t.Fatalf("bad: %d", num)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,7 +46,7 @@ func init() {
|
|||
|
||||
func TestWorker_dequeueEvaluation(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -82,7 +82,7 @@ func TestWorker_dequeueEvaluation(t *testing.T) {
|
|||
// evals for the same job.
|
||||
func TestWorker_dequeueEvaluation_SerialJobs(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -150,7 +150,7 @@ func TestWorker_dequeueEvaluation_SerialJobs(t *testing.T) {
|
|||
|
||||
func TestWorker_dequeueEvaluation_paused(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -197,7 +197,7 @@ func TestWorker_dequeueEvaluation_paused(t *testing.T) {
|
|||
|
||||
func TestWorker_dequeueEvaluation_shutdown(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -226,7 +226,7 @@ func TestWorker_dequeueEvaluation_shutdown(t *testing.T) {
|
|||
|
||||
func TestWorker_sendAck(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -273,7 +273,7 @@ func TestWorker_sendAck(t *testing.T) {
|
|||
|
||||
func TestWorker_waitForIndex(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -308,7 +308,7 @@ func TestWorker_waitForIndex(t *testing.T) {
|
|||
|
||||
func TestWorker_invokeScheduler(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -326,7 +326,7 @@ func TestWorker_invokeScheduler(t *testing.T) {
|
|||
|
||||
func TestWorker_SubmitPlan(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -391,7 +391,7 @@ func TestWorker_SubmitPlan(t *testing.T) {
|
|||
|
||||
func TestWorker_SubmitPlan_MissingNodeRefresh(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -461,7 +461,7 @@ func TestWorker_SubmitPlan_MissingNodeRefresh(t *testing.T) {
|
|||
|
||||
func TestWorker_UpdateEval(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -508,7 +508,7 @@ func TestWorker_UpdateEval(t *testing.T) {
|
|||
|
||||
func TestWorker_CreateEval(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
@ -556,7 +556,7 @@ func TestWorker_CreateEval(t *testing.T) {
|
|||
|
||||
func TestWorker_ReblockEval(t *testing.T) {
|
||||
t.Parallel()
|
||||
s1 := testServer(t, func(c *Config) {
|
||||
s1 := TestServer(t, func(c *Config) {
|
||||
c.NumSchedulers = 0
|
||||
c.EnabledSchedulers = []string{structs.JobTypeService}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue