@@ -408,7 +408,9 @@ class SentryOptionsTest {
408408 externalOptions.isGlobalHubMode = true
409409 externalOptions.isEnableLogs = true
410410 externalOptions.profileSessionSampleRate = 0.8
411+ externalOptions.profilingTracesDirPath = " /profiling-traces"
411412
413+ val hash = StringUtils .calculateStringHash(externalOptions.dsn, mock())
412414 val options = SentryOptions ()
413415
414416 options.merge(externalOptions)
@@ -463,6 +465,7 @@ class SentryOptionsTest {
463465 assertTrue(options.isGlobalHubMode!! )
464466 assertTrue(options.logs.isEnabled!! )
465467 assertEquals(0.8 , options.profileSessionSampleRate)
468+ assertEquals(" /profiling-traces${File .separator}${hash} " , options.profilingTracesDirPath)
466469 }
467470
468471 @Test
@@ -534,6 +537,23 @@ class SentryOptionsTest {
534537 )
535538 }
536539
540+ @Test
541+ fun `when cacheDirPath and profilingTracesDirPath are set, profilingTracesDirPath takes precedence` () {
542+ val dsn = " http://key@localhost/proj"
543+ val hash = StringUtils .calculateStringHash(dsn, mock())
544+ val options =
545+ SentryOptions ().apply {
546+ setDsn(dsn)
547+ cacheDirPath = " ${File .separator} test"
548+ profilingTracesDirPath = " ${File .separator} test-profiles"
549+ }
550+
551+ assertEquals(
552+ " ${File .separator} test-profiles${File .separator}${hash} " ,
553+ options.profilingTracesDirPath,
554+ )
555+ }
556+
537557 @Test
538558 fun `getCacheDirPathWithoutDsn does not contain dsn hash` () {
539559 val dsn = " http://key@localhost/proj"
0 commit comments