From fbcf87c4fb58e832c0c0237c4eb232c0452a6e6b Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Fri, 16 Sep 2022 11:37:19 +0300 Subject: [PATCH] Fixup EnableIfOidcExistsCondition condition for running tests locally Signed-off-by: Vladimir Sitnikov --- .../src/main/kotlin/build-logic.testing.gradle.kts | 1 - .../sigstore/testkit/EnableIfOidcExistsCondition.kt | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build-logic/jvm/src/main/kotlin/build-logic.testing.gradle.kts b/build-logic/jvm/src/main/kotlin/build-logic.testing.gradle.kts index c01129a1..d59bf474 100644 --- a/build-logic/jvm/src/main/kotlin/build-logic.testing.gradle.kts +++ b/build-logic/jvm/src/main/kotlin/build-logic.testing.gradle.kts @@ -1,6 +1,5 @@ tasks.withType().configureEach { if (project.hasProperty("skipOidc")) { - println("skipOidc: ${project.findProperty("skipOidc")}") systemProperty("sigstore-java.test.skipOidc", project.findProperty("skipOidc")!!) } } diff --git a/sigstore-testkit/src/main/kotlin/dev/sigstore/testkit/EnableIfOidcExistsCondition.kt b/sigstore-testkit/src/main/kotlin/dev/sigstore/testkit/EnableIfOidcExistsCondition.kt index dfd7bd5d..0d4b6538 100644 --- a/sigstore-testkit/src/main/kotlin/dev/sigstore/testkit/EnableIfOidcExistsCondition.kt +++ b/sigstore-testkit/src/main/kotlin/dev/sigstore/testkit/EnableIfOidcExistsCondition.kt @@ -32,12 +32,13 @@ class EnableIfOidcExistsCondition : ExecutionCondition { .map { it.provider }.orElse(OidcProviderType.ANY) return when { - provider == OidcProviderType.MANUAL -> - if (System.getenv("CI") == "true") { - disabled("CI environment is present, and the test has been configured to run with MANUAL OIDC only") - } else { - enabled("the test has been configured with MANUAL OIDC, and no CI environment variable is detected") - } + provider == OidcProviderType.MANUAL && + System.getenv("CI") == "true" -> + disabled("CI environment variable is present, and the test has been configured to run with MANUAL OIDC only") + + provider in listOf(OidcProviderType.ANY, OidcProviderType.MANUAL) && + System.getenv("CI") != "true" -> + enabled("the test has been configured with MANUAL OIDC, and no CI environment variable is detected") provider in listOf(OidcProviderType.ANY, OidcProviderType.CI, OidcProviderType.GITHUB) && System.getenv("ACTIONS_ID_TOKEN_REQUEST_URL") != null ->