File decompress() throws IOException {
        return decompress(uncheck(() -> java.nio.file.Files.createTempDirectory("decompress")).toFile());
    }
@Test
    public void require_that_nested_app_can_be_unpacked() throws IOException, InterruptedException {
        File gzFile = createTarGz("src/test/resources/deploy/advancedapp");
        assertTrue(gzFile.exists());
        File outApp;
        try (CompressedApplicationInputStream unpacked = streamFromTarGz(gzFile)) {
            outApp = unpacked.decompress();
        }
        List<File> files = List.of(Objects.requireNonNull(outApp.listFiles()));
        assertEquals(5, files.size());
        assertTrue(files.contains(new File(outApp, "services.xml")));
        assertTrue(files.contains(new File(outApp, "hosts.xml")));
        assertTrue(files.contains(new File(outApp, "deployment.xml")));
        assertTrue(files.contains(new File(outApp, "schemas")));
        assertTrue(files.contains(new File(outApp, "external")));
        File sd = files.get(files.indexOf(new File(outApp, "schemas")));
        assertTrue(sd.isDirectory());
        assertEquals(1, sd.listFiles().length);
        assertEquals(new File(sd, "keyvalue.sd").getAbsolutePath(), sd.listFiles()[0].getAbsolutePath());

        File ext = files.get(files.indexOf(new File(outApp, "external")));
        assertTrue(ext.isDirectory());
        assertEquals(1, ext.listFiles().length);
        assertEquals(new File(ext, "foo").getAbsolutePath(), ext.listFiles()[0].getAbsolutePath());

        files = List.of(ext.listFiles());
        File foo = files.get(files.indexOf(new File(ext, "foo")));
        assertTrue(foo.isDirectory());
        assertEquals(1, foo.listFiles().length);
        assertEquals(new File(foo, "bar").getAbsolutePath(), foo.listFiles()[0].getAbsolutePath());

        files = List.of(foo.listFiles());
        File bar = files.get(files.indexOf(new File(foo, "bar")));
        assertTrue(bar.isDirectory());
        assertEquals(1, bar.listFiles().length);
        assertTrue(bar.listFiles()[0].isFile());
        assertEquals(new File(bar, "lol").getAbsolutePath(), bar.listFiles()[0].getAbsolutePath());
    }