You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Kirk Lund (Jira)" <ji...@apache.org> on 2021/04/20 17:44:00 UTC
[jira] [Assigned] (GEODE-9178) ClassPathLoaderTest >
testZeroLengthFile intermittently fails and touches filesystem
[ https://issues.apache.org/jira/browse/GEODE-9178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kirk Lund reassigned GEODE-9178:
--------------------------------
Assignee: Kirk Lund
> ClassPathLoaderTest > testZeroLengthFile intermittently fails and touches filesystem
> ------------------------------------------------------------------------------------
>
> Key: GEODE-9178
> URL: https://issues.apache.org/jira/browse/GEODE-9178
> Project: Geode
> Issue Type: Bug
> Components: tests
> Reporter: Kirk Lund
> Assignee: Kirk Lund
> Priority: Major
>
> PR failure: https://concourse.apachegeode-ci.info/builds/27301
> {noformat}
> > Task :geode-core:test
> org.apache.geode.internal.classloader.ClassPathLoaderTest > testZeroLengthFile FAILED
> java.lang.AssertionError:
> Expecting actual throwable to be an instance of:
> java.lang.IllegalArgumentException
> but was:
> java.lang.NullPointerException
> at java.io.File.<init>(File.java:365)
> at org.apache.geode.deployment.internal.JarDeployer.getNextVersionedJarFile(JarDeployer.java:101)
> at org.apache.geode.deployment.internal.JarDeployer.deployWithoutRegistering(JarDeployer.java:84)
> ...(59 remaining lines not displayed - this can be changed with Assertions.setMaxStackTraceElementsDisplayed)
> at org.apache.geode.internal.classloader.ClassPathLoaderTest.testZeroLengthFile(ClassPathLoaderTest.java:109)
> {noformat}
> ClassPathLoaderTest also uses TemporaryFolder and uses the filesystem which does not belong in a "Unit Test":
> {noformat}
> @Test
> public void testZeroLengthFile() throws IOException {
> File zeroFile = tempFolder.newFile("JarDeployerDUnitZLF.jar");
> zeroFile.createNewFile();
> JarDeploymentService jarDeploymentService =
> JarDeploymentServiceFactory.getJarDeploymentServiceInstance();
> assertThatThrownBy(() -> {
> Deployment deployment =
> new Deployment("JarDeployerDUnitZLF.jar", "test", Instant.now().toString());
> deployment.setFile(zeroFile);
> jarDeploymentService.deploy(
> deployment);
> }).isInstanceOf(IllegalArgumentException.class);
> byte[] validBytes = new ClassBuilder().createJarFromName("JarDeployerDUnitZLF1");
> File validFile = tempFolder.newFile("JarDeployerDUnitZLF1.jar");
> IOUtils.copy(new ByteArrayInputStream(validBytes), new FileOutputStream(validFile));
> Set<File> files = new HashSet<>();
> files.add(validFile);
> files.add(zeroFile);
> assertThatThrownBy(() -> {
> for (File file : files) {
> Deployment deployment = new Deployment(file.getName(), "test", Instant.now().toString());
> deployment.setFile(file);
> jarDeploymentService.deploy(deployment);
> }
> }).isInstanceOf(IllegalArgumentException.class);
> // clean up the deployed files
> jarDeploymentService.listDeployed()
> .forEach(deployment -> jarDeploymentService
> .undeployByDeploymentName(deployment.getDeploymentName()));
> }
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)