diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackFloatingIpTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackFloatingIpTest.php
index c9b6c26b..8f7cb804 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackFloatingIpTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackFloatingIpTest.php
@@ -518,7 +518,7 @@ class OpenStackFloatingIpTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::OPENSTACK_FLOATING_IP_REPEAT_COUNT; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackImageTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackImageTest.php
index 641a307f..b26aeb2a 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackImageTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackImageTest.php
@@ -417,6 +417,7 @@ class OpenStackImageTest extends OpenStackTestBase {
    * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
    * @throws \Drupal\Core\Entity\EntityStorageException
+   * @throws \Exception
    */
   public function testUpdateAllImageList(): void {
     $cloud_configs = [];
@@ -428,7 +429,7 @@ class OpenStackImageTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::OPENSTACK_IMAGE_REPEAT_COUNT; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceBulkTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceBulkTest.php
index ec8e1e50..c156b72a 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceBulkTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceBulkTest.php
@@ -103,7 +103,7 @@ class OpenStackInstanceBulkTest extends OpenStackTestBase {
    *
    * @throws \Exception
    */
-  public function testStartInstanceBulk() {
+  public function testStartInstanceBulk(): void {
     $regions = ['RegionOne'];
 
     for ($i = 0, $num = 1; $i < self::OPENSTACK_INSTANCE_REPEAT_COUNT; $i++, $num++) {
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceTest.php
index 68d46e71..c9469b11 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackInstanceTest.php
@@ -614,7 +614,7 @@ class OpenStackInstanceTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::OPENSTACK_INSTANCE_REPEAT_COUNT; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackKeyPairTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackKeyPairTest.php
index 4cca9aed..ff8bed30 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackKeyPairTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackKeyPairTest.php
@@ -242,6 +242,7 @@ class OpenStackKeyPairTest extends OpenStackTestBase {
    * Test updating all key pair list.
    *
    * @throws \Behat\Mink\Exception\ExpectationException
+   * @throws \Exception
    */
   public function testUpdateAllKeyPairList(): void {
     $cloud_configs = [];
@@ -253,7 +254,7 @@ class OpenStackKeyPairTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::OPENSTACK_KEY_PAIR_REPEAT_COUNT; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackNetworkInterfaceTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackNetworkInterfaceTest.php
index 0be2f817..76887ed9 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackNetworkInterfaceTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackNetworkInterfaceTest.php
@@ -365,6 +365,7 @@ class OpenStackNetworkInterfaceTest extends OpenStackTestBase {
    * Test updating all network interface.
    *
    * @throws \Behat\Mink\Exception\ExpectationException
+   * @throws \Exception
    */
   public function testUpdateAllNetworkInterfaceList(): void {
     $cloud_configs = [];
@@ -376,7 +377,7 @@ class OpenStackNetworkInterfaceTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::OPENSTACK_NETWORK_INTERFACE_REPEAT_COUNT; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupTest.php
index e1a83da2..8987dc62 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupTest.php
@@ -360,6 +360,7 @@ class OpenStackSecurityGroupTest extends OpenStackTestBase {
    * Tests updating all security groups.
    *
    * @throws \Behat\Mink\Exception\ExpectationException
+   * @throws \Exception
    */
   public function testUpdateAllSecurityGroupList(): void {
     $cloud_configs = [];
@@ -374,7 +375,7 @@ class OpenStackSecurityGroupTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::$openStackSecurityGroupRepeatCount; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSnapshotTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSnapshotTest.php
index c85563ff..8d46f5a8 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSnapshotTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSnapshotTest.php
@@ -204,7 +204,7 @@ class OpenStackSnapshotTest extends OpenStackTestBase {
    *
    * @throws \Behat\Mink\Exception\ExpectationException
    */
-  public function testUpdateSnapshotList() {
+  public function testUpdateSnapshotList(): void {
 
     $cloud_context = $this->cloudContext;
     $openstack_ec2_api = $this->cloudConfig->get('field_use_openstack_ec2_api')->value;
@@ -382,8 +382,9 @@ class OpenStackSnapshotTest extends OpenStackTestBase {
    * Test updating all snapshot list.
    *
    * @throws \Behat\Mink\Exception\ExpectationException
+   * @throws \Exception
    */
-  public function testUpdateAllSnapshotList() {
+  public function testUpdateAllSnapshotList(): void {
     $cloud_configs = [];
 
     // List Snapshot for OpenStack.
@@ -393,7 +394,7 @@ class OpenStackSnapshotTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::OPENSTACK_SNAPSHOT_REPEAT_COUNT; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackVolumeTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackVolumeTest.php
index 3854238f..e4c2c938 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackVolumeTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackVolumeTest.php
@@ -374,7 +374,7 @@ class OpenStackVolumeTest extends OpenStackTestBase {
     // Create Cloud Config.
     for ($i = 0; $i < self::OPENSTACK_VOLUME_REPEAT_COUNT; $i++) {
       $this->cloudContext = $this->random->name(8);
-      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext);
+      $cloud_config = $this->createCloudConfigTestEntity($this->cloudContext, $this->cloudConfig->get('field_use_openstack_ec2_api')->value);
       $cloud_configs[] = $cloud_config;
     }
 
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStackTestBase.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStackTestBase.php
index 6e25a585..c4731e17 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStackTestBase.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStackTestBase.php
@@ -55,6 +55,8 @@ abstract class OpenStackTestBase extends CloudTestBase {
    *
    * @return \Drupal\cloud\Entity\CloudConfig
    *   The cloud service provider (CloudConfig) entity.
+   *
+   * @throws \Exception
    */
   protected function createCloudContext($bundle = 'openstack'): CloudContentEntityBase {
     $random = $this->random;
@@ -66,7 +68,7 @@ abstract class OpenStackTestBase extends CloudTestBase {
       'cloud_context'               => $cloud_context_name,
       'name'                        => $cloud_context_name,
       'label'                       => "OpenStack RegionOne - {$random->name(8, TRUE)}",
-      'field_use_openstack_ec2_api' => FALSE,
+      'field_use_openstack_ec2_api' => (bool) random_int(0, 1),
       'field_account_id'            => '',
       'field_api_endpoint'          => 'http://openstack.endpoint:8788',
       'field_os_region'             => 'RegionOne',
diff --git a/modules/cloud_service_providers/openstack/tests/src/Traits/OpenStackTestEntityTrait.php b/modules/cloud_service_providers/openstack/tests/src/Traits/OpenStackTestEntityTrait.php
index 6f8fa3ac..5bd9d734 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Traits/OpenStackTestEntityTrait.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Traits/OpenStackTestEntityTrait.php
@@ -31,7 +31,7 @@ trait OpenStackTestEntityTrait {
    *
    * @throws \Exception
    */
-  protected function createCloudConfigTestEntity($cloud_context, $ec2_api = TRUE) {
+  protected function createCloudConfigTestEntity($cloud_context, $ec2_api = TRUE): object {
     $random = $this->random;
     $num = random_int(1, 3);
 
@@ -60,6 +60,8 @@ trait OpenStackTestEntityTrait {
    *
    * @return \Drupal\cloud\Entity\CloudContentEntityBase
    *   The CloudServerTemplate entity.
+   *
+   * @throws \Drupal\Core\Entity\EntityStorageException
    */
   protected function createOpenStackServerTemplateTestEntity(array $iam_roles,
                                                     OpenStackImage $image,
