> +
> + @AfterClass(alwaysRun = true)
> + public void testDelete() throws Exception {
> + URI uri = api().delete(resourcegroup);
> + assertNotNull(uri);
> + assertTrue(uri.toString().contains("api-version"));
> + assertTrue(uri.toString().contains("operationresults"));
> +
> + JobStatus status = api.getJobApi().jobStatus(uri);
> + assertEquals(status, JobStatus.IN_PROGRESS);
> + while (status == JobStatus.IN_PROGRESS){
> + status = api.getJobApi().jobStatus(uri);
> + if (status == JobStatus.DONE){
> + break;
> + }
> + }
Do delete operations take a considerable amount of time? Would it make sense to
timeout the operation at some point? If that makes sense, a common and
straightforward pattern to do that in jclouds is to use one of the
[Predicates2.retry](http://jclouds.apache.org/reference/javadoc/1.9.x/org/jclouds/util/Predicates2.html)
variants. Something like:
```java
boolean jobDone = Predicates2.retry(new Predicate<URI>() {
@Override public boolean apply(URI uri) {
return JobStatus.DONE == api.getJobApi().jobStatus(uri);
}
}, 60 * 2 * 1000 /* 2 minutes timeout */).apply(uri);
assertTrue(jobDone, "delete operation did not complete in the configured
timeout");
```
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/250/files/d69ec53fd4b92d8f787d91bb58733c09181e47ac#r58670327