|
1 | 1 | package nomad
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "fmt" |
5 |
| - "net" |
6 | 4 | "testing"
|
7 | 5 |
|
8 | 6 | msgpackrpc "github.com/hashicorp/net-rpc-msgpackrpc"
|
9 |
| - "github.com/shoenig/test/must" |
10 |
| - "github.com/stretchr/testify/assert" |
11 |
| - "github.com/stretchr/testify/require" |
12 |
| - |
13 | 7 | "github.com/hashicorp/nomad/acl"
|
14 | 8 | "github.com/hashicorp/nomad/ci"
|
15 | 9 | "github.com/hashicorp/nomad/helper/uuid"
|
16 | 10 | "github.com/hashicorp/nomad/nomad/mock"
|
17 | 11 | "github.com/hashicorp/nomad/nomad/structs"
|
18 | 12 | "github.com/hashicorp/nomad/testutil"
|
| 13 | + "github.com/stretchr/testify/assert" |
| 14 | + "github.com/stretchr/testify/require" |
19 | 15 | )
|
20 | 16 |
|
21 | 17 | func TestStatusPing(t *testing.T) {
|
@@ -77,54 +73,6 @@ func TestStatusPeers(t *testing.T) {
|
77 | 73 | }
|
78 | 74 | }
|
79 | 75 |
|
80 |
| -func TestStatus_RPCServers(t *testing.T) { |
81 |
| - ci.Parallel(t) |
82 |
| - |
83 |
| - advAddr1 := "127.0.1.1:1234" |
84 |
| - adv1, err := net.ResolveTCPAddr("tcp", advAddr1) |
85 |
| - must.NoError(t, err) |
86 |
| - |
87 |
| - s1, cleanupS1 := TestServer(t, func(c *Config) { |
88 |
| - c.Region = "region1" |
89 |
| - c.ClientRPCAdvertise = adv1 |
90 |
| - }) |
91 |
| - defer cleanupS1() |
92 |
| - |
93 |
| - s2, cleanupS2 := TestServer(t, func(c *Config) { |
94 |
| - c.Region = "region2" |
95 |
| - }) |
96 |
| - defer cleanupS2() |
97 |
| - |
98 |
| - // Join them together |
99 |
| - s2Addr := fmt.Sprintf("127.0.0.1:%d", s2.config.SerfConfig.MemberlistConfig.BindPort) |
100 |
| - n, err := s1.Join([]string{s2Addr}) |
101 |
| - must.NoError(t, err, must.Sprintf("Failed joining: %v (%d joined)", err, n)) |
102 |
| - |
103 |
| - codec := rpcClient(t, s1) |
104 |
| - |
105 |
| - t.Run("own region", func(t *testing.T) { |
106 |
| - arg := &structs.GenericRequest{ |
107 |
| - QueryOptions: structs.QueryOptions{Region: "region1"}, |
108 |
| - } |
109 |
| - var resp *structs.RPCServersResponse |
110 |
| - must.NoError(t, msgpackrpc.CallWithCodec(codec, "Status.RPCServers", arg, &resp)) |
111 |
| - must.NotNil(t, resp) |
112 |
| - must.Len(t, 1, resp.Addresses) |
113 |
| - must.Eq(t, advAddr1, resp.Addresses[0]) |
114 |
| - }) |
115 |
| - |
116 |
| - t.Run("other region", func(t *testing.T) { |
117 |
| - arg := &structs.GenericRequest{ |
118 |
| - QueryOptions: structs.QueryOptions{Region: "region2"}, |
119 |
| - } |
120 |
| - var resp *structs.RPCServersResponse |
121 |
| - must.NoError(t, msgpackrpc.CallWithCodec(codec, "Status.RPCServers", arg, &resp)) |
122 |
| - must.NotNil(t, resp) |
123 |
| - must.Len(t, 1, resp.Addresses) |
124 |
| - must.Eq(t, s2.clientRpcAdvertise.String(), resp.Addresses[0]) |
125 |
| - }) |
126 |
| -} |
127 |
| - |
128 | 76 | func TestStatusMembers(t *testing.T) {
|
129 | 77 | ci.Parallel(t)
|
130 | 78 |
|
|
0 commit comments