@Ignore
@Test
public void testForkMachines() throws KaramelException, RunNodesException {

  NovaLauncher novaLauncher = new NovaLauncher(novaContext, sshKeyPair);
  //mocking uploadSSHPublicKey
  String keypairName = "pepeKeyPair";
  KeyPair pair = mock(KeyPair.class);
  List<KeyPair> keyPairList = new ArrayList<>();
  keyPairList.add(pair);
  FluentIterable<KeyPair> keys = FluentIterable.from(keyPairList);
  when(keyPairApi.list()).thenReturn(keys);
  when(keyPairApi.delete(keypairName)).thenReturn(true);
  when(keyPairApi.createWithPublicKey(keypairName, sshKeyPair.getPublicKey())).thenReturn(pair);
  //mocking
  JsonCluster cluster = mock(JsonCluster.class);
  ClusterRuntime clusterRuntime = mock(ClusterRuntime.class);
  when(clusterRuntime.getName()).thenReturn(clusterName);
  List<JsonGroup> groups = new ArrayList<>();
  //mocking json group
  JsonGroup group = mock(JsonGroup.class);
  groups.add(group);
  when(group.getName()).thenReturn(groupName);
  when(group.getProvider()).thenReturn(nova);
  when(group.getSize()).thenReturn(1);
  //mocking json cluster
  when(cluster.getGroups()).thenReturn(groups);
  when(cluster.getProvider()).thenReturn(nova);
  when(cluster.getName()).thenReturn(clusterName);
  //mocking group runtime
  List<GroupRuntime> groupRuntimes = new ArrayList<>();
  GroupRuntime groupRuntime = mock(GroupRuntime.class);
  when(groupRuntime.getName()).thenReturn(groupName);
  when(groupRuntime.getId()).thenReturn("10");
  when(groupRuntime.getCluster()).thenReturn(clusterRuntime);
  groupRuntimes.add(groupRuntime);
  //mocking clusterRuntime
  when(clusterRuntime.getGroups()).thenReturn(groupRuntimes);
  //mocking templateOptions
  NovaTemplateOptions novaTemplateOptions = mock(NovaTemplateOptions.class);
  TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
  TemplateOptions templateOptions = mock(TemplateOptions.class);
  when(novaContext.getComputeService()).thenReturn(novaComputeService);
  when(novaComputeService.templateOptions()).thenReturn(novaTemplateOptions);
  when(novaTemplateOptions.securityGroups(Matchers.anyCollection())).thenReturn(novaTemplateOptions);
  when(templateOptions.as(NovaTemplateOptions.class)).thenReturn(novaTemplateOptions);
  when(novaComputeService.templateBuilder()).thenReturn(templateBuilder);
  //mock builder
  when(novaTemplateOptions.keyPairName(keypairName)).thenReturn(novaTemplateOptions);
  when(novaTemplateOptions.autoAssignFloatingIp(true)).thenReturn(novaTemplateOptions);
  when(novaTemplateOptions.nodeNames(Matchers.anyCollection())).thenReturn(novaTemplateOptions);
  //mock success nodes
  Set<NodeMetadata> succeededNodes = new HashSet<>();
  NodeMetadata succeededNode = mock(NodeMetadata.class);
  succeededNodes.add(succeededNode);
  doReturn(succeededNodes).when(novaComputeService)
          .createNodesInGroup(Matchers.anyString(), eq(1), Matchers.any(Template.class));
  LoginCredentials loginCredentials = mock(LoginCredentials.class);
  Set<String> ipAddresses = new HashSet<>();
  ipAddresses.add("127.0.0.1");
  when(succeededNode.getPublicAddresses()).thenReturn(ipAddresses);
  when(succeededNode.getPrivateAddresses()).thenReturn(ipAddresses);
  when(succeededNode.getLoginPort()).thenReturn(22);
  when(succeededNode.getCredentials()).thenReturn(loginCredentials);
  when(loginCredentials.getUser()).thenReturn("ubuntu");
  //testing method
  List<MachineRuntime> forkedMachines =novaLauncher.forkMachines(cluster,clusterRuntime,groupName);
  assertNotNull(forkedMachines);
  assertFalse(forkedMachines.isEmpty());
}