TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
Template template = mock(Template.class);
when(getCompute.apply(clusterSpec)).thenReturn(serviceContext);
when(serviceContext.getComputeService()).thenReturn(computeService);
when(computeService.templateBuilder()).thenReturn(templateBuilder);
when(templateBuilder.options((TemplateOptions) any())).thenReturn(templateBuilder);
when(templateBuilder.build()).thenReturn(template);
// here is a scenario when jt+nn fails once, then the retry is successful
// and from the dn+tt one node fails, then the retry is successful