Skip to content

Commit

Permalink
fix schema validation for update_route + add test
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Mar 27, 2020
1 parent 097d085 commit 64226f8
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,85 @@ describe('UPDATE remote clusters', () => {
},
},
});
updateRemoteClustersTest('updates v1 proxy cluster', {
apiResponses: [
async () => ({
test: {
connected: true,
initial_connect_timeout: '30s',
skip_unavailable: false,
seeds: ['127.0.0.1:9300'],
},
}),
async () => ({
acknowledged: true,
persistent: {
cluster: {
remote: {
test: {
connected: true,
proxy_address: '127.0.0.1:9300',
initial_connect_timeout: '30s',
skip_unavailable: true,
mode: 'proxy',
proxy_socket_connections: 18,
},
},
},
},
transient: {},
}),
],
params: {
name: 'test',
},
payload: {
proxyAddress: '127.0.0.1:9300',
skipUnavailable: true,
mode: 'proxy',
hasDeprecatedProxySetting: true,
serverName: '',
proxySocketConnections: 18,
},
asserts: {
apiArguments: [
['cluster.remoteInfo'],
[
'cluster.putSettings',
{
body: {
persistent: {
cluster: {
remote: {
test: {
proxy_address: '127.0.0.1:9300',
skip_unavailable: true,
mode: 'proxy',
node_connections: null,
seeds: null,
proxy_socket_connections: 18,
server_name: null,
proxy: null,
},
},
},
},
},
},
],
],
statusCode: 200,
result: {
initialConnectTimeout: '30s',
isConfiguredByNode: false,
isConnected: true,
proxyAddress: '127.0.0.1:9300',
name: 'test',
skipUnavailable: true,
mode: 'proxy',
},
},
});
});

describe('failure', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const bodyValidation = schema.object({
proxyAddress: schema.nullable(schema.string()),
proxySocketConnections: schema.nullable(schema.number()),
serverName: schema.nullable(schema.string()),
hasDeprecatedProxySetting: schema.maybe(schema.boolean()),
});

const paramsValidation = schema.object({
Expand Down

0 comments on commit 64226f8

Please sign in to comment.