-
Notifications
You must be signed in to change notification settings - Fork 20
Attach prebuilt libraries to GitHub releases #300
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
Merged
+83
−64
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
22d84dd
Attach prebuilt libraries to GitHub releases
simolus3 3ca6d9c
Add testutils dependency since core is gone
simolus3 a229eac
Revert compose changes
simolus3 53d0c18
Review feedback
simolus3 b12b834
Prepare release
simolus3 81b2dfb
Fix device tests
simolus3 bc1169f
Use separate test class for encrypted tests
simolus3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 5 additions & 44 deletions
49
core-tests-android/src/androidTest/java/com/powersync/EncryptedDatabaseTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,18 @@ | ||
| package com.powersync | ||
|
|
||
| import com.powersync.testutils.IntegrationTestHelpers | ||
| import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
| import androidx.test.platform.app.InstrumentationRegistry | ||
| import androidx.sqlite.SQLiteException | ||
| import androidx.sqlite.execSQL | ||
| import app.cash.turbine.turbineScope | ||
| import com.powersync.db.schema.Schema | ||
| import com.powersync.encryption.AndroidEncryptedDatabaseFactory | ||
| import com.powersync.encryption.Key | ||
| import com.powersync.testutils.UserRow | ||
| import kotlinx.coroutines.* | ||
| import kotlinx.coroutines.runBlocking | ||
| import kotlinx.coroutines.test.runTest | ||
| import org.junit.After | ||
| import org.junit.Assert.* | ||
| import org.junit.Before | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
|
|
||
| @RunWith(AndroidJUnit4::class) | ||
| class EncryptedDatabaseTest { | ||
|
|
||
| private val helpers = IntegrationTestHelpers( | ||
| InstrumentationRegistry.getInstrumentation().targetContext | ||
| ) | ||
| @Test | ||
| fun testEncryptedDatabase() = | ||
| runTest { | ||
| val context = InstrumentationRegistry.getInstrumentation().targetContext | ||
|
|
||
| val database = PowerSyncDatabase( | ||
| factory = AndroidEncryptedDatabaseFactory( | ||
| context, | ||
| Key.Passphrase("mykey") | ||
| ), | ||
| schema = Schema(UserRow.table), | ||
| dbFilename = "encrypted_test", | ||
| ) | ||
|
|
||
| assertEquals("chacha20", database.get("PRAGMA cipher") { it.getString(0)!! }) | ||
|
|
||
| database.execute( | ||
| "INSERT INTO users (id, name, email) VALUES (uuid(), ?, ?)", | ||
| listOf("Test", "test@example.org"), | ||
| ) | ||
| database.close() | ||
|
|
||
| val unencryptedFactory = DatabaseDriverFactory(context) | ||
| val unencrypted = unencryptedFactory.openConnection("encrypted_test", null, false) | ||
|
|
||
| try { | ||
| unencrypted.execSQL("SELECT * FROM sqlite_schema") | ||
| throw IllegalStateException("Was able to read schema from encrypted database without supplying a key") | ||
| } catch (_: SQLiteException) { | ||
| // Expected | ||
| } | ||
| unencrypted.close() | ||
| } | ||
| fun testEncryptedDatabase() = helpers.testEncryptedDatabase() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.