Skip to content
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

Liveness integration tests #46

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Integration tests
run-name: Integration tests for ${{ github.ref }}

on:
pull_request:
branches:
- 'main'
merge_group:
types: [checks_requested]

env:
AWS_REGION: "us-east-1"

jobs:
ci-integration-tests:
permissions:
id-token: write # This is required for requesting the JWT with configure-aws-credentials
contents: read # This is required for actions/checkout
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2
with:
role-to-assume: ${{ vars.AMPLIFY_UI_ANDROID_CI_TESTS_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- name: Run Integration Tests
uses: aws-actions/aws-codebuild-run-build@f202c327329cbbebd13f986f74af162a8539b5fd # v1
with:
project-name: Amplify-UI-Android-Integration-Test
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class AuthenticatorViewModelTest {

@Test
fun `start only executes once`() = runTest {
coEvery { authProvider.fetchAuthSession() }.returns(AmplifyResult.Error(mockAuthException()))
tjleing marked this conversation as resolved.
Show resolved Hide resolved
viewModel.start(mockAuthConfiguration())
viewModel.start(mockAuthConfiguration())
advanceUntilIdle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
// Needed when running integration tests. The oauth2 library uses relies on two
// dependencies (Apache's httpcore and httpclient), both of which include
// META-INF/DEPENDENCIES. Tried a couple other options to no avail.
// More collisions occurred using JUnit, so also adding LICENSE-*.md files.
packaging {
resources.excludes.add("META-INF/DEPENDENCIES")
resources.excludes.add("META-INF/LICENSE.md")
resources.excludes.add("META-INF/LICENSE-notice.md")
}

buildFeatures {
Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ dependencies {
kover(project(":authenticator"))
kover(project(":liveness"))
}

apply(from = rootProject.file("configuration/instrumentation-tests.gradle"))
45 changes: 45 additions & 0 deletions configuration/instrumentation-tests.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Need to create backends for s3, pinpoint, predictions, core
*/
def module_backends = [
'liveness' : 'LivenessIntegTests',
]

def canaryTests = [
// 'liveness' : [''],
]

subprojects {
afterEvaluate { project ->
if (module_backends.containsKey(project.name)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be implemented as a convention plugin an then applied in relevant projects. See here for our existing convention plugins.

task runTestsInDeviceFarm {
doLast {
exec {
commandLine("$rootDir.path/scripts/run_test_in_devicefarm.sh")
args([project.name])
}
}
}
// task runNightlyTestsInDeviceFarmPool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out sections

// dependsOn(assembleAndroidTest)
// doLast {
// exec {
// commandLine("$rootDir.path/scripts/run_nightly_tests_in_devicefarm_pool.sh")
// args([project.name])
// }
// }
// }
// task runCanaryInDeviceFarm {
// dependsOn(assembleAndroidTest)
// doLast {
// for (canary in canaryTests[project.name]) {
// exec {
// commandLine("$rootDir.path/scripts/run_canary_in_devicefarm.sh")
// args(project.name, canary)
// }
// }
// }
// }
}
}
}
6 changes: 5 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ zxing = { module = "com.google.zxing:core", version.ref = "zxing" }

# Testing libraries
test-androidx-junit = "androidx.test.ext:junit:1.1.4"
test-androidx-monitor = "androidx.test:monitor:1.5.0"
test-androidx-rules = "androidx.test:rules:1.5.0"
test-compose-junit = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" }
test-compose-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" }
test-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
test-espresso = "androidx.test.espresso:espresso-core:3.5.1"
test-junit = "junit:junit:4.13.2"
test-kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
test-mockk = "io.mockk:mockk:1.13.4"
test-mockk = "io.mockk:mockk:1.13.8"
test-mockk-android = "io.mockk:mockk-android:1.13.8"
test-robolectric = "org.robolectric:robolectric:4.9.2"
test-turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" }
debug-ui-test-manifest = "androidx.compose.ui:ui-test-manifest:1.5.0-beta01"

# Dependencies for convention plugins
plugin-android-gradle = { module = "com.android.tools.build:gradle", version.ref = "agp" }
Expand Down
12 changes: 12 additions & 0 deletions liveness/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ android {
androidResources {
noCompress += "tflite"
}

packagingOptions {
resources.excludes.add("META-INF/LICENSE.md")
resources.excludes.add("META-INF/LICENSE-notice.md")
}
}

dependencies {
Expand All @@ -52,4 +57,11 @@ dependencies {
implementation(libs.tensorflow.support)

testImplementation(projects.testing)
androidTestImplementation(libs.amplify.auth)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this auth dependency necessary here?

androidTestImplementation(libs.test.compose.junit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wrap all of these testing dependencies up in a bundle in the toml file so that we don't have to repeat this if we add integration tests elsewhere.

androidTestImplementation(libs.test.androidx.monitor)
androidTestImplementation(libs.test.androidx.rules)
androidTestImplementation(libs.test.junit)
androidTestImplementation(libs.test.mockk.android)
debugImplementation(libs.debug.ui.test.manifest)
}
Loading
Loading