Skip to content

Commit

Permalink
chore: test case for already encrypted dbs
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkAtra committed Nov 15, 2024
1 parent 7e8d178 commit 9048f0f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ object DatabaseConfigurationTestUtils {
val DATABASE_FILE_V1_2_x by lazy { DatabaseConfigurationTestUtils::class.java.getResource("/persistence/v1.2.db")!! }
val DATABASE_FILE_V2_10_5 by lazy { DatabaseConfigurationTestUtils::class.java.getResource("/persistence/v2.10.5.db")!! }
val DATABASE_FILE_V2_10_5_WITH_PASSWORD by lazy { DatabaseConfigurationTestUtils::class.java.getResource("/persistence/v2.10.5-with-password.db")!! }
val DATABASE_FILE_V2_12_0_WITH_PASSWORD by lazy { DatabaseConfigurationTestUtils::class.java.getResource("/persistence/v2.12.0-with-password.db")!! }

private val logger by lazy { LoggerFactory.getLogger(javaClass) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,17 @@ class DatabaseMigrationServiceTest {
assertThat(server.statusMonitor!!.recentErrors).isEmpty()
}
}

@Test
fun `should not attempt to encrypt an already encrypted database`(capturedOutput: CapturedOutput) {

DatabaseConfigurationTestUtils.getTestDatabase(DatabaseConfigurationTestUtils.DATABASE_FILE_V2_12_0_WITH_PASSWORD, "test", "test").use { database ->

assertThat(capturedOutput.out).doesNotContain("Successfully encrypted the database.")

database.getRepository(Server::class.java).use { serverRepository ->
assertThat(serverRepository.size()).isEqualTo(1)
}
}
}
}
Binary file not shown.

0 comments on commit 9048f0f

Please sign in to comment.