naver / ngrinder

enterprise level performance testing solution
naver.github.io/ngrinder
Apache License 2.0
2k stars 478 forks source link

Bug computing file digest in mixed environments (windows-linux) #985

Open manuelsanchezortiz opened 1 year ago

manuelsanchezortiz commented 1 year ago

1. Describe the bug 🐞

nGrinder v. 3.5.8

All libraries are sent again; cached data is always refreshed in mixed environments, windows, linux.

File hashing calculation includes the file native path son a hash like this on windows: \lib\sdclient-1.1.3-SNAPSHOT.jar:021d1f3049c13032c59bd63e29071d93

is on linux: /lib/sdclient-1.1.3-SNAPSHOT.jar:021d1f3049c13032c59bd63e29071d93

So files are always different.

Also I don't no why, files are distributed to all agents, not only the linux one.

2. Reproduction steps

  1. Install nGrinder Controller, an Agent on Windows. Install another Agent in a Linux system
  2. Run any test with some library and/or resources
  3. See how files are distributed
  4. Repeat the same test. Files are distributed again to all agents

3. Environment

4. Screenshots

I think the problem is here, because File.getPath() uses system depedent file.separator.

FileUtils.java public static String getFileDigest(File baseDir, File file) { try { return getSubPath(baseDir.getPath(), file.getPath()) + ":" + getMd5(file); } catch (IOException e) { throw new NGrinderRuntimeException(e); } }