Skip to content

Commit 3a087ce

Browse files
committed
Merge branch 'master' into 4740-feat
Signed-off-by: Bernát Gábor <[email protected]>
2 parents 982b4db + 00c2c86 commit 3a087ce

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
run: ./dev/main
5959
- name: Upload artifact
60-
uses: actions/upload-artifact@v4
60+
uses: actions/upload-artifact@v5
6161
with:
6262
name: opengrok-${{ github.sha }}-${{ matrix.os }}.tar.gz
6363
path: distribution/target/opengrok-*.tar.gz

opengrok-indexer/src/test/java/org/opengrok/indexer/search/SearchEngineTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void testSortOrderLastModified() {
167167
int hitsCount = instance.search();
168168
List<Hit> hits = new ArrayList<>();
169169
instance.results(0, hitsCount, hits);
170-
assertTrue(hits.size() != 6, "Should return at least 2 hits for RELEVANCY sort to check order");
170+
assertTrue(hits.size() == 6, "Should return at least 2 hits for RELEVANCY sort to check order");
171171

172172
String[] results = hits.stream().
173173
map(hit -> hit.getPath() + "@" + hit.getLineno()).
@@ -195,7 +195,7 @@ void testSortOrderByPath() {
195195
int hitsCount = instance.search();
196196
List<Hit> hits = new ArrayList<>();
197197
instance.results(0, hitsCount, hits);
198-
assertTrue(hits.size() != 11, "Should return at least 2 hits for RELEVANCY sort to check order");
198+
assertTrue(hits.size() == 11, "Should return at least 2 hits for RELEVANCY sort to check order");
199199

200200
String[] results = hits.stream().
201201
map(hit -> hit.getPath() + "@" + hit.getLineno()).

opengrok-indexer/src/test/java/org/opengrok/indexer/util/TestRepository.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import java.nio.file.FileSystems;
3333
import java.nio.file.Files;
3434
import java.nio.file.Path;
35+
import java.nio.file.attribute.FileTime;
36+
import java.time.Instant;
3537
import java.util.LinkedHashMap;
3638
import java.util.List;
3739
import java.util.Map;
@@ -135,26 +137,27 @@ public void copyDirectory(Path src, Path dest) throws IOException {
135137
}
136138

137139
/**
138-
* Assumes the destination directory exists.
140+
* Create a deterministic order of paths for creation time.
141+
* This is so last modified time indexing is stable in tests. Note we cannot use
142+
* Files.copy(sourceFile, destPath, REPLACE_EXISTING, COPY_ATTRIBUTES) as the original creation time is the user
143+
* checkout and not different across files.
144+
*
139145
* @param src source directory
140146
* @param dest destination directory
141147
* @throws IOException on error
142148
*/
143149
public void copyDirectoryWithUniqueModifiedTime(Path src, Path dest) throws IOException {
144-
// Create a deterministic order of paths for creation time, so last modified time indexing is stable in tests
145-
// note we cannot use Files.copy(sourceFile, destPath, REPLACE_EXISTING, COPY_ATTRIBUTES)
146-
// as the original creation time is the user checkout and not different accross files
147-
List<Path> allPaths;
150+
List<Path> allPaths;
148151
try (Stream<Path> stream = Files.walk(src)) {
149152
allPaths = stream.filter(p -> !p.equals(src)).sorted().toList();
150153
}
151154
// Set base time to now, and go ahead in time for each subsequent path by 1 minute
152-
java.time.Instant baseTime = java.time.Instant.now();
155+
Instant baseTime = java.time.Instant.now();
153156
for (int i = 0; i < allPaths.size(); i++) {
154157
Path sourcePath = allPaths.get(i);
155158
Path destRelativePath = getDestinationRelativePath(src, sourcePath);
156159
Path destPath = dest.resolve(destRelativePath);
157-
var fileTime = java.nio.file.attribute.FileTime.from(baseTime.plusSeconds(i * 60L));
160+
var fileTime = FileTime.from(baseTime.plusSeconds(i * 60L));
158161
if (Files.isDirectory(sourcePath)) {
159162
if (!Files.exists(destPath)) {
160163
Files.createDirectories(destPath);

0 commit comments

Comments
 (0)