This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch 3.15.x
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/3.15.x by this push:
     new c41400737f fixes #7056 Option for disabling identity tests except 
key-vault
c41400737f is described below

commit c41400737f766dae6f9f5d20a98832cb49bdc8e9
Author: Jiri Ondrusek <ondrusek.j...@gmail.com>
AuthorDate: Wed Feb 26 10:42:55 2025 +0100

    fixes #7056 Option for disabling identity tests except key-vault
---
 integration-test-groups/azure/README.adoc                        | 2 ++
 .../component/azure/eventhubs/it/AzureCredentialsHelper.java     | 5 +++++
 .../component/azure/storage/blob/it/AzureStorageHelper.java      | 9 +++++++++
 3 files changed, 16 insertions(+)

diff --git a/integration-test-groups/azure/README.adoc 
b/integration-test-groups/azure/README.adoc
index 55a067376c..288bbda5f4 100644
--- a/integration-test-groups/azure/README.adoc
+++ b/integration-test-groups/azure/README.adoc
@@ -59,6 +59,8 @@ $ ./azure-resources.sh delete
 
 You may want to `export CAMEL_QUARKUS_START_MOCK_BACKEND=false` to avoid 
starting the local Azurite container and make sure that you test against the 
real remote Azure API.
 
+You may want to disable identity tests except key-vault (which is mandatory)  
`export CAMEL_QUARKUS_DISABLE_IDENTITY_EXCEPT_KEY_VAULT=true` to avoid starting 
test using identity with other extension then key-vault. This option might be 
helpful in case of testing with client without permissions for eventhubs.
+
 ==== Regenerating client certificates
 
 For convenience, a certificate is stored in this project to be used for client 
certificate authentication. It can be regenerated as follows.
diff --git 
a/integration-test-groups/azure/azure-eventhubs/src/main/java/org/apache/camel/quarkus/component/azure/eventhubs/it/AzureCredentialsHelper.java
 
b/integration-test-groups/azure/azure-eventhubs/src/main/java/org/apache/camel/quarkus/component/azure/eventhubs/it/AzureCredentialsHelper.java
index df9687c78a..865174e6aa 100644
--- 
a/integration-test-groups/azure/azure-eventhubs/src/main/java/org/apache/camel/quarkus/component/azure/eventhubs/it/AzureCredentialsHelper.java
+++ 
b/integration-test-groups/azure/azure-eventhubs/src/main/java/org/apache/camel/quarkus/component/azure/eventhubs/it/AzureCredentialsHelper.java
@@ -45,6 +45,11 @@ public final class AzureCredentialsHelper {
         if (isMockBackEnd()) {
             return false;
         }
+        Optional<Boolean> disableIdentity = 
config.getOptionalValue("CAMEL_QUARKUS_DISABLE_IDENTITY_EXCEPT_KEY_VAULT",
+                Boolean.class);
+        if (disableIdentity.isPresent() && disableIdentity.get()) {
+            return false;
+        }
 
         Optional<String> clientId = config.getOptionalValue("azure.client.id", 
String.class);
         Optional<String> tenantId = config.getOptionalValue("azure.tenant.id", 
String.class);
diff --git 
a/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageHelper.java
 
b/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageHelper.java
index b9a6c7a498..8254297b7f 100644
--- 
a/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageHelper.java
+++ 
b/integration-test-groups/azure/azure-storage-blob/src/main/java/org/apache/camel/quarkus/component/azure/storage/blob/it/AzureStorageHelper.java
@@ -30,6 +30,7 @@ public class AzureStorageHelper {
         @Override
         public boolean getAsBoolean() {
             return !MockBackendUtils.startMockBackend() &&
+                    
!isAzureConfigValueEquals("CAMEL_QUARKUS_DISABLE_IDENTITY_EXCEPT_KEY_VAULT", 
Boolean.class, true) &&
                     isAzureConfigValuePresent("azure.client.id") &&
                     isAzureConfigValuePresent("azure.tenant.id") &&
                     isAzureConfigValuePresent("azure.client.secret");
@@ -63,4 +64,12 @@ public class AzureStorageHelper {
                 .getOptionalValue(name, String.class)
                 .isPresent();
     }
+
+    private static <T> boolean isAzureConfigValueEquals(String name, Class<T> 
type, T expectedValue) {
+        return ConfigProvider.getConfig()
+                .getOptionalValue(name, type)
+                .isPresent()
+                && expectedValue.equals(
+                        ConfigProvider.getConfig().getValue(name, type));
+    }
 }

Reply via email to