SOLR-12792: extract test data into separate files in autoscaling tests

This commit is contained in:
Noble Paul 2018-09-21 13:26:52 +10:00
parent 6adeb5bc44
commit 1d604d1b3f
2 changed files with 143 additions and 176 deletions

View File

@ -0,0 +1,141 @@
{"diagnostics":{
"sortedNodes":[{
"node":"127.0.0.1:63191_solr",
"isLive":true,
"cores":3.0,
"freedisk":680.908073425293,
"heapUsage":24.97510064011647,
"sysLoadAvg":272.75390625,
"totaldisk":1037.938980102539,
"replicas":{"readApiTestViolations":{"shard1":[{"core_node5":{
"core":"readApiTestViolations_shard1_replica_n2",
"leader":"true",
"base_url":"https://127.0.0.1:63191/solr",
"node_name":"127.0.0.1:63191_solr",
"state":"active",
"type":"NRT",
"force_set_state":"false",
"INDEX.sizeInGB":6.426125764846802E-8,
"shard":"shard1",
"collection":"readApiTestViolations"}},
{"core_node7":{
"core":"readApiTestViolations_shard1_replica_n4",
"base_url":"https://127.0.0.1:63191/solr",
"node_name":"127.0.0.1:63191_solr",
"state":"active",
"type":"NRT",
"force_set_state":"false",
"INDEX.sizeInGB":6.426125764846802E-8,
"shard":"shard1",
"collection":"readApiTestViolations"}},
{"core_node12":{
"core":"readApiTestViolations_shard1_replica_n10",
"base_url":"https://127.0.0.1:63191/solr",
"node_name":"127.0.0.1:63191_solr",
"state":"active",
"type":"NRT",
"force_set_state":"false",
"INDEX.sizeInGB":6.426125764846802E-8,
"shard":"shard1",
"collection":"readApiTestViolations"}}]}}},
{
"node":"127.0.0.1:63192_solr",
"isLive":true,
"cores":3.0,
"freedisk":680.908073425293,
"heapUsage":24.98878807983566,
"sysLoadAvg":272.75390625,
"totaldisk":1037.938980102539,
"replicas":{"readApiTestViolations":{"shard1":[{"core_node3":{
"core":"readApiTestViolations_shard1_replica_n1",
"base_url":"https://127.0.0.1:63192/solr",
"node_name":"127.0.0.1:63192_solr",
"state":"active",
"type":"NRT",
"force_set_state":"false",
"INDEX.sizeInGB":6.426125764846802E-8,
"shard":"shard1",
"collection":"readApiTestViolations"}},
{"core_node9":{
"core":"readApiTestViolations_shard1_replica_n6",
"base_url":"https://127.0.0.1:63192/solr",
"node_name":"127.0.0.1:63192_solr",
"state":"active",
"type":"NRT",
"force_set_state":"false",
"INDEX.sizeInGB":6.426125764846802E-8,
"shard":"shard1",
"collection":"readApiTestViolations"}},
{"core_node11":{
"core":"readApiTestViolations_shard1_replica_n8",
"base_url":"https://127.0.0.1:63192/solr",
"node_name":"127.0.0.1:63192_solr",
"state":"active",
"type":"NRT",
"force_set_state":"false",
"INDEX.sizeInGB":6.426125764846802E-8,
"shard":"shard1",
"collection":"readApiTestViolations"}}]}}},
{
"node":"127.0.0.1:63219_solr",
"isLive":true,
"cores":0.0,
"freedisk":680.908073425293,
"heapUsage":24.98878807983566,
"sysLoadAvg":272.75390625,
"totaldisk":1037.938980102539,
"replicas":{}}],
"liveNodes":["127.0.0.1:63191_solr",
"127.0.0.1:63192_solr",
"127.0.0.1:63219_solr"],
"violations":[{
"collection":"readApiTestViolations",
"shard":"shard1",
"node":"127.0.0.1:63191_solr",
"violation":{
"replica":{
"NRT":3,
"count":3},
"delta":2.0},
"clause":{
"replica":"<3",
"shard":"#EACH",
"node":"#ANY",
"collection":"readApiTestViolations"}},
{
"collection":"readApiTestViolations",
"shard":"shard1",
"node":"127.0.0.1:63192_solr",
"violation":{
"replica":{
"NRT":3,
"count":3},
"delta":2.0},
"clause":{
"replica":"<2",
"shard":"#EACH",
"node":"#ANY",
"collection":"readApiTestViolations"}}],
"config":{
"cluster-preferences":[{
"minimize":"cores",
"precision":3},
{
"maximize":"freedisk",
"precision":100},
{
"minimize":"sysLoadAvg",
"precision":10},
{
"minimize":"heapUsage",
"precision":10}],
"cluster-policy":[{
"cores":"<10",
"node":"#ANY"},
{
"replica":"<2",
"shard":"#EACH",
"node":"#ANY"},
{
"nodeRole":"overseer",
"replica":0}]}}}

View File

@ -291,182 +291,8 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
};
}
public void testAutoScalingHandlerFailure() {
String diagnostics = "{" +
" 'diagnostics': {" +
" 'sortedNodes': [" +
" {" +
" 'node': '127.0.0.1:63191_solr'," +
" 'isLive': true," +
" 'cores': 3.0," +
" 'freedisk': 680.908073425293," +
" 'heapUsage': 24.97510064011647," +
" 'sysLoadAvg': 272.75390625," +
" 'totaldisk': 1037.938980102539," +
" 'replicas': {" +
" 'readApiTestViolations': {" +
" 'shard1': [" +
" {" +
" 'core_node5': {" +
" 'core': 'readApiTestViolations_shard1_replica_n2'," +
" 'leader': 'true'," +
" 'base_url': 'https://127.0.0.1:63191/solr'," +
" 'node_name': '127.0.0.1:63191_solr'," +
" 'state': 'active'," +
" 'type': 'NRT'," +
" 'force_set_state': 'false'," +
" 'INDEX.sizeInGB': 6.426125764846802E-8," +
" 'shard': 'shard1'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }," +
" {" +
" 'core_node7': {" +
" 'core': 'readApiTestViolations_shard1_replica_n4'," +
" 'base_url': 'https://127.0.0.1:63191/solr'," +
" 'node_name': '127.0.0.1:63191_solr'," +
" 'state': 'active'," +
" 'type': 'NRT'," +
" 'force_set_state': 'false'," +
" 'INDEX.sizeInGB': 6.426125764846802E-8," +
" 'shard': 'shard1'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }," +
" {" +
" 'core_node12': {" +
" 'core': 'readApiTestViolations_shard1_replica_n10'," +
" 'base_url': 'https://127.0.0.1:63191/solr'," +
" 'node_name': '127.0.0.1:63191_solr'," +
" 'state': 'active'," +
" 'type': 'NRT'," +
" 'force_set_state': 'false'," +
" 'INDEX.sizeInGB': 6.426125764846802E-8," +
" 'shard': 'shard1'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }" +
" ]" +
" }" +
" }" +
" }," +
" {" +
" 'node': '127.0.0.1:63192_solr'," +
" 'isLive': true," +
" 'cores': 3.0," +
" 'freedisk': 680.908073425293," +
" 'heapUsage': 24.98878807983566," +
" 'sysLoadAvg': 272.75390625," +
" 'totaldisk': 1037.938980102539," +
" 'replicas': {" +
" 'readApiTestViolations': {" +
" 'shard1': [" +
" {" +
" 'core_node3': {" +
" 'core': 'readApiTestViolations_shard1_replica_n1'," +
" 'base_url': 'https://127.0.0.1:63192/solr'," +
" 'node_name': '127.0.0.1:63192_solr'," +
" 'state': 'active'," +
" 'type': 'NRT'," +
" 'force_set_state': 'false'," +
" 'INDEX.sizeInGB': 6.426125764846802E-8," +
" 'shard': 'shard1'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }," +
" {" +
" 'core_node9': {" +
" 'core': 'readApiTestViolations_shard1_replica_n6'," +
" 'base_url': 'https://127.0.0.1:63192/solr'," +
" 'node_name': '127.0.0.1:63192_solr'," +
" 'state': 'active'," +
" 'type': 'NRT'," +
" 'force_set_state': 'false'," +
" 'INDEX.sizeInGB': 6.426125764846802E-8," +
" 'shard': 'shard1'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }," +
" {" +
" 'core_node11': {" +
" 'core': 'readApiTestViolations_shard1_replica_n8'," +
" 'base_url': 'https://127.0.0.1:63192/solr'," +
" 'node_name': '127.0.0.1:63192_solr'," +
" 'state': 'active'," +
" 'type': 'NRT'," +
" 'force_set_state': 'false'," +
" 'INDEX.sizeInGB': 6.426125764846802E-8," +
" 'shard': 'shard1'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }" +
" ]" +
" }" +
" }" +
" }," +
" {" +
" 'node': '127.0.0.1:63219_solr'," +
" 'isLive': true," +
" 'cores': 0.0," +
" 'freedisk': 680.908073425293," +
" 'heapUsage': 24.98878807983566," +
" 'sysLoadAvg': 272.75390625," +
" 'totaldisk': 1037.938980102539," +
" 'replicas': {}" +
" }" +
" ]," +
" 'liveNodes': [" +
" '127.0.0.1:63191_solr'," +
" '127.0.0.1:63192_solr'," +
" '127.0.0.1:63219_solr'" +
" ]," +
" 'violations': [" +
" {" +
" 'collection': 'readApiTestViolations'," +
" 'shard': 'shard1'," +
" 'node': '127.0.0.1:63191_solr'," +
" 'violation': {" +
" 'replica': {'NRT': 3, 'count': 3}," +
" 'delta': 2.0" +
" }," +
" 'clause': {" +
" 'replica': '<3'," +
" 'shard': '#EACH'," +
" 'node': '#ANY'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }," +
" {" +
" 'collection': 'readApiTestViolations'," +
" 'shard': 'shard1'," +
" 'node': '127.0.0.1:63192_solr'," +
" 'violation': {" +
" 'replica': {'NRT': 3, 'count': 3}," +
" 'delta': 2.0" +
" }," +
" 'clause': {" +
" 'replica': '<2'," +
" 'shard': '#EACH'," +
" 'node': '#ANY'," +
" 'collection': 'readApiTestViolations'" +
" }" +
" }" +
" ]," +
" 'config': {" +
" 'cluster-preferences': [" +
" {'minimize': 'cores', 'precision': 3}," +
" {'maximize': 'freedisk', 'precision': 100}," +
" {'minimize': 'sysLoadAvg', 'precision': 10}," +
" {'minimize': 'heapUsage', 'precision': 10}" +
" ]," +
" 'cluster-policy': [" +
" {'cores': '<10', 'node': '#ANY'}," +
" {'replica': '<2', 'shard': '#EACH', 'node': '#ANY'}," +
" {'nodeRole': 'overseer', 'replica': 0}" +
" ]" +
" }" +
" }}";
Map<String, Object> m = (Map<String, Object>) Utils.fromJSONString(diagnostics);
public void testAutoScalingHandlerFailure() throws IOException {
Map<String, Object> m = (Map<String, Object>) loadFromResource("testAutoScalingHandlerFailure.json");
Policy policy = new Policy((Map<String, Object>) Utils.getObjectByPath(m, false, "diagnostics/config"));
SolrCloudManager cloudManagerFromDiagnostics = createCloudManagerFromDiagnostics(m);