You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "karim-ramadan (via GitHub)" <gi...@apache.org> on 2023/04/07 08:01:59 UTC

[GitHub] [iceberg] karim-ramadan commented on issue #7287: Broken Unit tests on Windows OS

karim-ramadan commented on issue #7287:
URL: https://github.com/apache/iceberg/issues/7287#issuecomment-1500047391

   Hi @jackye1995 I'd like to open a PR to fix it, I was also thinking instead of fixing all the problems case by case we could create a class like this 
   
   `
   public class UriFileSystem {
     File parent;
   
     public UriFileSystem(URI uri) {
       this.parent = Paths.get(uri).toFile();
     }
   
     public UriFileSystem(File file) {
       this.parent = file;
     }
   
     public UriFileSystem(Path path) {
       this.parent = path.toFile();
     }
   
     public URI newFolder(String... paths) throws IOException {
       if (paths.length == 0) {
         return parent.toURI();
       }
       File f = parent;
       for (String p : paths) {
         f = new File(f, p);
       }
       f.mkdirs();
       return f.toURI();
     }
   
     public URI newFile(String name) throws IOException {
       File f = new File(parent, name);
       f.createNewFile();
       return f.toURI();
     }
   
     public static Stream<URI> listFiles(URI location) {
       return Arrays.stream(Objects.requireNonNull(Paths.get(location).toFile().listFiles()))
           .map(File::toURI);
     }
   }
   `
   Inside the core test module, in this way, we could manage all resources as URIs avoiding silly mistakes and ensuring that in the future tests are always compatible across all OS.
   What do you think? 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org