You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Zack Shoylev <no...@github.com> on 2013/11/26 21:19:06 UTC

[jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

You can merge this Pull Request by running:

  git pull https://github.com/rackspace/jclouds fix-windows-delete

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds/pull/217

-- Commit Summary --

  * Fixes filesystem tests sometimes failing on Windows.

-- File Changes --

    M apis/filesystem/src/main/java/org/jclouds/filesystem/util/Utils.java (9)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/217.patch
https://github.com/jclouds/jclouds/pull/217.diff

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Zack Shoylev <no...@github.com>.
> How about simply waiting 5s straight away?

Used in setUp step and potentially other places; don't want to slow tests down, they are slow as is.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217#issuecomment-29333029

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Andrew Gaul <no...@github.com>.
> @@ -41,7 +44,11 @@ public static void deleteRecursively(File file) throws IOException {
>           }
>        }
>        if (!file.delete()) {
> -         throw new IOException("Could not delete: " + file);
> +         // On windows, often the directory does not register as empty right away.
> +         Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);

@zack-shoylev this seems fragile; we most likely cannot delete a file on Windows because someone else has a handle to it.  We should  revert this commit and close the handle.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217/files#r7943972

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #886](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/886/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217#issuecomment-29331796

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Andrew Phillips <no...@github.com>.
One small comment. Thanks, @zack-shoylev!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217#issuecomment-29331229

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Andrew Phillips <no...@github.com>.
> don't want to slow tests down, they are slow as is.

Fair enough!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217#issuecomment-29333331

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #423](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/423/) UNSTABLE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217#issuecomment-29331490

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Andrew Phillips <no...@github.com>.
> jclouds-pull-requests #423 UNSTABLE

Unrelated [test failure](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/org.apache.jclouds$jclouds-compute/423/testReport/junit/org.jclouds.compute.callables/BlockUntilInitScriptStatusIsZeroThenReturnOutputTest/testloopUntilTrueOrThrowCancellationExceptionReturnsWhenPredicateIsTrueSecondTimeWhileNotCancelled/)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217#issuecomment-29331909

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Zack Shoylev <no...@github.com>.
> @@ -41,7 +44,11 @@ public static void deleteRecursively(File file) throws IOException {
>           }
>        }
>        if (!file.delete()) {
> -         throw new IOException("Could not delete: " + file);
> +         // On windows, often the directory does not register as empty right away.
> +         Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);

Yes it did; as you see this is just a single retry after an error.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217/files#r7961015

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Andrew Phillips <no...@github.com>.
> @@ -41,7 +44,11 @@ public static void deleteRecursively(File file) throws IOException {
>           }
>        }
>        if (!file.delete()) {
> -         throw new IOException("Could not delete: " + file);
> +         // On windows, often the directory does not register as empty right away.
> +         Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
> +         if(!file.delete()) {
> +            throw new IOException("Could not delete: " + file);
> +         }

How about simply waiting 5s straight away?
```
Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
if (!file.delete()) {
  throw new IOException("Could not delete: " + file);
}
```
But also fine as is ;-)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217/files#r7938272

Re: [jclouds] Fixes filesystem tests sometimes failing on Windows. (#217)

Posted by Andrew Phillips <no...@github.com>.
> @@ -41,7 +44,11 @@ public static void deleteRecursively(File file) throws IOException {
>           }
>        }
>        if (!file.delete()) {
> -         throw new IOException("Could not delete: " + file);
> +         // On windows, often the directory does not register as empty right away.
> +         Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);

Fair point, @andrewgaul. @zack-shoylev: did the 5s delay improve things in your test runs? I'm guessing so..?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/217/files#r7958442