Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.github.dockerjava.core.dockerfile;

import com.google.common.base.Stopwatch;
import lombok.SneakyThrows;
import org.junit.Test;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertEquals;

public class DockerfileLargeDirTest {

@Test
public void shouldScanWithLargeExcludedSubdirectoryInLessThanThreeSeconds() throws IOException, URISyntaxException {
final Path dockerfilePath = getDockerfilePath();
final Dockerfile dockerfile = new Dockerfile(dockerfilePath.toFile(), dockerfilePath.getParent().toFile());
Stopwatch stopwatch = com.google.common.base.Stopwatch.createStarted();
Dockerfile.ScannedResult parse = dockerfile.parse();
assertEquals("scan finishes in under 5 seconds", 5000, Math.max(stopwatch.elapsed(TimeUnit.MILLISECONDS), 5000));
assertEquals("9 files were added", 9, parse.filesToAdd.size());
}

@SneakyThrows
private Path getDockerfilePath() throws URISyntaxException {
return Paths.get(DockerfileLargeDirTest.class.getResource("/buildTests/largedir/Dockerfile").toURI());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
largesubdir
!largesubdir/directory_70/file_1
!largesubdir/directory_120/file_11
!largesubdir/directory_134/file_22
!largesubdir/directory_136/file_42
!largesubdir/directory_137/file_10
!largesubdir/directory_137/file_1
!largesubdir/directory_140/file_20
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM hello-world
Loading