Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,25 @@ public void loadFromReadOnlyDirectory() throws GeoWebCacheException {
@Test
public void loadFromEmptyReadOnlyDirectoryFails() throws GeoWebCacheException, IOException {
File roEmptyDir = this.temp.newFolder();
Assume.assumeTrue(
"Ignore if setWritable(false) does not succeed, may happen on Windows", roEmptyDir.setWritable(false));

// Try to make it read-only
roEmptyDir.setWritable(false);

// Actively probe whether the directory is still writable (for gwc-release Docker on Windows)
File probe = new File(roEmptyDir, "probe");
boolean canWrite;
try {
canWrite = probe.createNewFile();
if (canWrite) {
probe.delete();
}
} catch (IOException e) {
canWrite = false;
}

// Skip if we can still write, this may happen on Windows
Assume.assumeTrue("Skipping: directory is still writable", !canWrite);

try {
config = new XMLConfiguration(null, roEmptyDir.getAbsolutePath());
config.setGridSetBroker(gridSetBroker);
Expand Down
Loading