File tree Expand file tree Collapse file tree 2 files changed +13
-1590
lines changed
dd-java-agent/instrumentation/openai-java/openai-java-3.0/src/test
resources/http-records/embeddings Expand file tree Collapse file tree 2 files changed +13
-1590
lines changed Original file line number Diff line number Diff line change 88import java .nio .charset .StandardCharsets ;
99import java .nio .file .Files ;
1010import java .nio .file .Path ;
11+ import java .nio .file .attribute .PosixFilePermissions ;
1112import java .security .MessageDigest ;
1213import java .util .List ;
1314import java .util .Map ;
1415
1516public class RequestResponseRecord {
16- public static final String RECORD_FILE_HASH_ALG = "MD5" ;
17-
17+ /**
18+ * Turn it on when the tests change to identify which records have been used and which can be
19+ * removed. This sets the execution attribute of the record file, so Git recognizes the file as
20+ * changed. This is useful for identifying unused records when changing tests.
21+ */
22+ public static final boolean SET_RECORD_FILE_ATTR_ON_READ = false ;
23+
24+ private static final String RECORD_FILE_HASH_ALG = "MD5" ;
1825 private static final String METHOD = "method: " ;
1926 private static final String PATH = "path: " ;
2027 private static final String BEGIN_REQUEST_BODY = "-- begin request body --" ;
@@ -171,6 +178,10 @@ public static RequestResponseRecord read(Path recFilePath) {
171178 bodyBuilder .append (line );
172179 }
173180 }
181+
182+ if (SET_RECORD_FILE_ATTR_ON_READ ) {
183+ Files .setPosixFilePermissions (recFilePath , PosixFilePermissions .fromString ("rwxr-xr-x" ));
184+ }
174185 } catch (IOException e ) {
175186 throw new RuntimeException (e );
176187 }
You can’t perform that action at this time.
0 commit comments