Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AR Fixes: task leader handling, restoring, state updating, AR.Destroy deadlocks #4803

Merged
merged 8 commits into from
Oct 29, 2018
16 changes: 8 additions & 8 deletions client/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ func TestClient_ACL_resolveTokenValue(t *testing.T) {
defer s1.Shutdown()
testutil.WaitForLeader(t, s1.RPC)

c1 := TestClient(t, func(c *config.Config) {
c1, cleanup := TestClient(t, func(c *config.Config) {
c.RPCHandler = s1
c.ACLEnabled = true
})
defer c1.Shutdown()
defer cleanup()

// Create a policy / token
policy := mock.ACLPolicy()
Expand Down Expand Up @@ -66,11 +66,11 @@ func TestClient_ACL_resolvePolicies(t *testing.T) {
defer s1.Shutdown()
testutil.WaitForLeader(t, s1.RPC)

c1 := TestClient(t, func(c *config.Config) {
c1, cleanup := TestClient(t, func(c *config.Config) {
c.RPCHandler = s1
c.ACLEnabled = true
})
defer c1.Shutdown()
defer cleanup()

// Create a policy / token
policy := mock.ACLPolicy()
Expand Down Expand Up @@ -106,10 +106,10 @@ func TestClient_ACL_ResolveToken_Disabled(t *testing.T) {
defer s1.Shutdown()
testutil.WaitForLeader(t, s1.RPC)

c1 := TestClient(t, func(c *config.Config) {
c1, cleanup := TestClient(t, func(c *config.Config) {
c.RPCHandler = s1
})
defer c1.Shutdown()
defer cleanup()

// Should always get nil when disabled
aclObj, err := c1.ResolveToken("blah")
Expand All @@ -122,11 +122,11 @@ func TestClient_ACL_ResolveToken(t *testing.T) {
defer s1.Shutdown()
testutil.WaitForLeader(t, s1.RPC)

c1 := TestClient(t, func(c *config.Config) {
c1, cleanup := TestClient(t, func(c *config.Config) {
c.RPCHandler = s1
c.ACLEnabled = true
})
defer c1.Shutdown()
defer cleanup()

// Create a policy / token
policy := mock.ACLPolicy()
Expand Down
21 changes: 12 additions & 9 deletions client/alloc_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (
func TestAllocations_GarbageCollectAll(t *testing.T) {
t.Parallel()
require := require.New(t)
client := TestClient(t, nil)
client, cleanup := TestClient(t, nil)
defer cleanup()

req := &nstructs.NodeSpecificRequest{}
var resp nstructs.GenericResponse
Expand All @@ -29,11 +30,11 @@ func TestAllocations_GarbageCollectAll_ACL(t *testing.T) {
server, addr, root := testACLServer(t, nil)
defer server.Shutdown()

client := TestClient(t, func(c *config.Config) {
client, cleanup := TestClient(t, func(c *config.Config) {
c.Servers = []string{addr}
c.ACLEnabled = true
})
defer client.Shutdown()
defer cleanup()

// Try request without a token and expect failure
{
Expand Down Expand Up @@ -79,9 +80,10 @@ func TestAllocations_GarbageCollect(t *testing.T) {
t.Skip("missing mock driver plugin implementation")
t.Parallel()
require := require.New(t)
client := TestClient(t, func(c *config.Config) {
client, cleanup := TestClient(t, func(c *config.Config) {
c.GCDiskUsageThreshold = 100.0
})
defer cleanup()

a := mock.Alloc()
a.Job.TaskGroups[0].Tasks[0].Driver = "mock_driver"
Expand Down Expand Up @@ -122,11 +124,11 @@ func TestAllocations_GarbageCollect_ACL(t *testing.T) {
server, addr, root := testACLServer(t, nil)
defer server.Shutdown()

client := TestClient(t, func(c *config.Config) {
client, cleanup := TestClient(t, func(c *config.Config) {
c.Servers = []string{addr}
c.ACLEnabled = true
})
defer client.Shutdown()
defer cleanup()

// Try request without a token and expect failure
{
Expand Down Expand Up @@ -178,7 +180,8 @@ func TestAllocations_Stats(t *testing.T) {
t.Skip("missing exec driver plugin implementation")
t.Parallel()
require := require.New(t)
client := TestClient(t, nil)
client, cleanup := TestClient(t, nil)
defer cleanup()

a := mock.Alloc()
require.Nil(client.addAlloc(a, ""))
Expand Down Expand Up @@ -213,11 +216,11 @@ func TestAllocations_Stats_ACL(t *testing.T) {
server, addr, root := testACLServer(t, nil)
defer server.Shutdown()

client := TestClient(t, func(c *config.Config) {
client, cleanup := TestClient(t, func(c *config.Config) {
c.Servers = []string{addr}
c.ACLEnabled = true
})
defer client.Shutdown()
defer cleanup()

// Try request without a token and expect failure
{
Expand Down
Loading