code:     public void restorePersistentSettingsTest() throws Exception {
          logger.info("--> start 2 nodes");
          Settings nodeSettings = settingsBuilder()
                  .put("discovery.type", "zen")
                  .put("discovery.zen.ping_timeout", "200ms")
                  .put("discovery.initial_state_timeout", "500ms")
                  .build();
          internalCluster().startNode(nodeSettings);
          Client client = client();
          String secondNode = internalCluster().startNode(nodeSettings);
          logger.info("--> wait for the second node to join the cluster");
          assertThat(client.admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut(), equalTo(false));
  
          int random = randomIntBetween(10, 42);
  
          logger.info("--> set test persistent setting");
          client.admin().cluster().prepareUpdateSettings().setPersistentSettings(
                  ImmutableSettings.settingsBuilder()
                          .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 2)
                          .put(IndicesTTLService.INDICES_TTL_INTERVAL, random, TimeUnit.MINUTES))
                  .execute().actionGet();
  
          assertThat(client.admin().cluster().prepareState().setRoutingTable(false).setNodes(false).execute().actionGet().getState()
                  .getMetaData().persistentSettings().getAsTime(IndicesTTLService.INDICES_TTL_INTERVAL, TimeValue.timeValueMinutes(1)).millis(), equalTo(TimeValue.timeValueMinutes(random).millis()));
          assertThat(client.admin().cluster().prepareState().setRoutingTable(false).setNodes(false).execute().actionGet().getState()
                  .getMetaData().persistentSettings().getAsInt(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, -1), equalTo(2));
  
          logger.info("--> create repository");
          PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo")
                  .setType("fs").setSettings(ImmutableSettings.settingsBuilder().put("location", randomRepoPath())).execute().actionGet();
          assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true));
  
          logger.info("--> start snapshot");
          CreateSnapshotResponse createSnapshotResponse = client.admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).execute().actionGet();
          assertThat(createSnapshotResponse.getSnapshotInfo().totalShards(), equalTo(0));
          assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(0));
          assertThat(client.admin().cluster().prepareGetSnapshots("test-repo").setSnapshots("test-snap").execute().actionGet().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS));
  
          logger.info("--> clean the test persistent setting");
          client.admin().cluster().prepareUpdateSettings().setPersistentSettings(
                  ImmutableSettings.settingsBuilder()
                          .put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, 1)
                          .put(IndicesTTLService.INDICES_TTL_INTERVAL, TimeValue.timeValueMinutes(1)))
                  .execute().actionGet();
          assertThat(client.admin().cluster().prepareState().setRoutingTable(false).setNodes(false).execute().actionGet().getState()
                  .getMetaData().persistentSettings().getAsTime(IndicesTTLService.INDICES_TTL_INTERVAL, TimeValue.timeValueMinutes(1)).millis(), equalTo(TimeValue.timeValueMinutes(1).millis()));
  
          stopNode(secondNode);
          assertThat(client.admin().cluster().prepareHealth().setWaitForNodes("1").get().isTimedOut(), equalTo(false));
  
          logger.info("--> restore snapshot");
          client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setRestoreGlobalState(true).setWaitForCompletion(true).execute().actionGet();
          assertThat(client.admin().cluster().prepareState().setRoutingTable(false).setNodes(false).execute().actionGet().getState()
                  .getMetaData().persistentSettings().getAsTime(IndicesTTLService.INDICES_TTL_INTERVAL, TimeValue.timeValueMinutes(1)).millis(), equalTo(TimeValue.timeValueMinutes(random).millis()));
  
          logger.info("--> ensure that zen discovery minimum master nodes wasn't restored");
          assertThat(client.admin().cluster().prepareState().setRoutingTable(false).setNodes(false).execute().actionGet().getState()
                  .getMetaData().persistentSettings().getAsInt(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES, -1), not(equalTo(2)));
      }
  
      @Test
  