diff --git a/modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/ElasticIpTest.php b/modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/ElasticIpTest.php
index 996e7606dcabf3e20d670fedd84405b5592daa7f..640f58930683ecea2f50d8ccb59a5922dc1e945a 100644
--- a/modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/ElasticIpTest.php
+++ b/modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/ElasticIpTest.php
@@ -160,7 +160,7 @@ class ElasticIpTest extends AwsCloudTestBase {
     // Create Elastic IPs.
     $elastic_ips = $this->createElasticIpRandomTestFormData();
     $edit = $this->createElasticIpTestFormData(self::AWS_CLOUD_ELASTIC_IP_REPEAT_COUNT);
-    for ($i = 0, $num = 1; $i < self::AWS_CLOUD_ELASTIC_IP_REPEAT_COUNT; $i++, $num++) {
+    for ($i = 0, $num = 1; $i < min(count($elastic_ips), self::AWS_CLOUD_ELASTIC_IP_REPEAT_COUNT); $i++, $num++) {
       $elastic_ip = $elastic_ips[$i];
       // Set up a test Elastic IP.
       $this->createElasticIpTestEntity($i, $elastic_ip['Name'], $elastic_ip['PublicIp'], $cloud_context);
diff --git a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupIpPermissionsTest.php b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupIpPermissionsTest.php
index dc8145a99c77d7fe5af042d341ea386924942722..2a674df6d1a566602cd6c67db6f7e7861f420df3 100644
--- a/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupIpPermissionsTest.php
+++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackSecurityGroupIpPermissionsTest.php
@@ -653,4 +653,15 @@ class OpenStackSecurityGroupIpPermissionsTest extends OpenStackTestBase {
     return $params;
   }
 
+  /**
+   * Check if service type is EC2 or REST.
+   *
+   * @return bool
+   *   TRUE if cloud config type is EC2 API, otherwise FALSE.
+   */
+  protected function getEc2ServiceType(): bool {
+    // OpenStack subnet uses REST only.
+    return FALSE;
+  }
+
 }