-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup resources better during Client Reset and closing Realms. #1515
Changes from 9 commits
d3e72a6
858719f
1630b0e
a5522b6
480628d
5e61ed2
f6009c5
4d4ea96
1b447ab
30d41c9
cdd26b7
950519d
1def218
4e42635
3307532
d58ad3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ import android.os.SystemClock | |
import java.io.File | ||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
import java.nio.file.attribute.PosixFilePermission | ||
import kotlin.io.path.absolutePathString | ||
import kotlin.time.Duration | ||
|
||
|
@@ -30,14 +29,8 @@ actual object PlatformUtils { | |
actual fun createTempDir(prefix: String, readOnly: Boolean): String { | ||
val dir: Path = Files.createTempDirectory("$prefix-android_tests") | ||
if (readOnly) { | ||
Files.setPosixFilePermissions( | ||
dir, | ||
setOf( | ||
PosixFilePermission.GROUP_READ, | ||
PosixFilePermission.OTHERS_READ, | ||
PosixFilePermission.OWNER_READ | ||
) | ||
) | ||
// Use the File API as it works across Windows and POSIX. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or does it ... since you disabled the test on windows because it doesn't work 🤪 |
||
dir.toFile().setReadOnly() | ||
} | ||
return dir.absolutePathString() | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ import io.realm.kotlin.entities.sync.flx.FlexEmbeddedObject | |
import io.realm.kotlin.entities.sync.flx.FlexParentObject | ||
import io.realm.kotlin.ext.query | ||
import io.realm.kotlin.internal.platform.runBlocking | ||
import io.realm.kotlin.log.LogLevel | ||
import io.realm.kotlin.mongodb.exceptions.CompensatingWriteException | ||
import io.realm.kotlin.mongodb.exceptions.DownloadingRealmTimeOutException | ||
import io.realm.kotlin.mongodb.exceptions.SyncException | ||
|
@@ -64,7 +63,7 @@ class FlexibleSyncIntegrationTests { | |
|
||
@BeforeTest | ||
fun setup() { | ||
app = TestApp(this::class.simpleName, appName = TEST_APP_FLEX, logLevel = LogLevel.ALL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be helpful to keep it all for CI failures? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remember having all the logs available was ever useful on CI. Just having the final exception seems to do the trick? |
||
app = TestApp(this::class.simpleName, appName = TEST_APP_FLEX) | ||
val (email, password) = TestHelper.randomEmail() to "password1234" | ||
runBlocking { | ||
app.createUserAndLogIn(email, password) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also close the pointers for Darwin? https://github.com/realm/realm-kotlin/blob/main/packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt#L2534-L2538
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we probably should. I'm only closing them here because it prevents Windows from removing the file, but you are correct. We should also behave nice on Darwin.