Add unit test for build-logic static ip tool.

main
Alex Hart 2023-03-01 11:29:02 -04:00 zatwierdzone przez Greyson Parrelli
rodzic 43aad90ee4
commit 3f62221182
2 zmienionych plików z 19 dodań i 6 usunięć

Wyświetl plik

@ -20,12 +20,23 @@ class StaticIpResolverTest {
@Test
fun `Given a hostname with records, when I resolveToBuildConfig, then I expect a matching IP`() {
val staticIpResolver = StaticIpResolver(FakeRecordFetcher(mapOf(
SIGNAL_DOT_ORG to arrayOf(ARecord(Name.fromString("www."), DClass.ANY, 0L, mockk<Inet4Address> {
every { address } returns SIGNAL_IP
every { hostAddress } returns STRINGIFIED_IP
}))
)))
val staticIpResolver = StaticIpResolver(
FakeRecordFetcher(
mapOf(
SIGNAL_DOT_ORG to arrayOf(
ARecord(
Name.fromString("www."),
DClass.ANY,
0L,
mockk<Inet4Address> {
every { address } returns SIGNAL_IP
every { hostAddress } returns STRINGIFIED_IP
}
)
)
)
)
)
val actual = staticIpResolver.resolveToBuildConfig(SIGNAL_DOT_ORG)
val expected = """
new String[]{"$STRINGIFIED_IP"}

Wyświetl plik

@ -64,6 +64,8 @@ task qa {
group 'Verification'
description 'Quality Assurance. Run before pushing.'
dependsOn 'clean',
gradle.includedBuild('build-logic').task(':tools:test'),
gradle.includedBuild('build-logic').task(':tools:ktlintCheck'),
':Signal-Android:testPlayProdReleaseUnitTest',
':Signal-Android:lintPlayProdRelease',
'Signal-Android:ktlintCheck',