code:     public void snapshotRecoveryTest() throws Exception {
          logger.info("--> start node A");
          String nodeA = internalCluster().startNode(settingsBuilder().put("gateway.type", "local"));
  
          logger.info("--> create repository");
          assertAcked(client().admin().cluster().preparePutRepository(REPO_NAME)
                  .setType("fs").setSettings(ImmutableSettings.settingsBuilder()
                                  .put("location", newTempDir(LifecycleScope.SUITE))
                                  .put("compress", false)
                  ).get());
  
          ensureGreen();
  
          logger.info("--> create index on node: {}", nodeA);
          createAndPopulateIndex(INDEX_NAME, 1, SHARD_COUNT, REPLICA_COUNT);
  
          logger.info("--> snapshot");
          CreateSnapshotResponse createSnapshotResponse = client().admin().cluster().prepareCreateSnapshot(REPO_NAME, SNAP_NAME)
                  .setWaitForCompletion(true).setIndices(INDEX_NAME).get();
          assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0));
          assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()));
  
          assertThat(client().admin().cluster().prepareGetSnapshots(REPO_NAME).setSnapshots(SNAP_NAME).get()
                  .getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS));
  
          client().admin().indices().prepareClose(INDEX_NAME).execute().actionGet();
  
          logger.info("--> restore");
          RestoreSnapshotResponse restoreSnapshotResponse = client().admin().cluster()
                  .prepareRestoreSnapshot(REPO_NAME, SNAP_NAME).setWaitForCompletion(true).execute().actionGet();
          int totalShards = restoreSnapshotResponse.getRestoreInfo().totalShards();
          assertThat(totalShards, greaterThan(0));
  
          ensureGreen();
  
          logger.info("--> request recoveries");
          RecoveryResponse response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
  
          for (Map.Entry<String, List<ShardRecoveryResponse>> shardRecoveryResponse : response.shardResponses().entrySet()) {
  
              assertThat(shardRecoveryResponse.getKey(), equalTo(INDEX_NAME));
              List<ShardRecoveryResponse> shardRecoveryResponses = shardRecoveryResponse.getValue();
              assertThat(shardRecoveryResponses.size(), equalTo(totalShards));
  
              for (ShardRecoveryResponse shardResponse : shardRecoveryResponses) {
                  assertRecoveryState(shardResponse.recoveryState(), 0, Type.SNAPSHOT, Stage.DONE, null, nodeA, true);
                  validateIndexRecoveryState(shardResponse.recoveryState().getIndex());
              }
          }
      }
  
  