Comments

nilesh.addweb created an issue. See original summary.

yoftahe.addweb’s picture

Status: Active » Needs review
StatusFileSize
new30.44 KB
yas’s picture

@nileshaddweb

Thank you for adding the test case. Now that we merged the patch at #3126453, we need to create test cases based on it.

yoftahe.addweb’s picture

jigish.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new29.85 KB
new39.42 KB

@yas

I refactored the code for testcase.

Please test new patch.

Thanks

yas’s picture

Status: Needs review » Needs work

@jigishaddweb

Thank you for the refactoring. I found the following.

  1. This code should be deleted from OpenStackNetworkInterfaceTest, and Drupal\Tests\aws_cloud\Functional\Ec2\NetworkInterfaceTest::createRandomSubnets() should be moved into Drupal\Tests\aws_cloud\Traits\AwsCloudTestFormDataTrait.
    +++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackNetworkInterfaceTest.php
    @@ -0,0 +1,410 @@
    
    +  /**
    +   * Create random subnets.
    +   *
    +   * @return array
    +   *   Random subnets array.
    +   *
    +   * @throws \Exception
    +   */
    +  private function createRandomSubnets(): array {
    +
    +    $subnets = [];
    +    $count = random_int(1, 10);
    +    for ($i = 0, $num = 1; $i < $count; $i++, $num++) {
    +      $subnets[] = [
    +        'SubnetId' => 'subnet-' . $this->getRandomId(),
    +        'Tags' => [
    +          [
    +            'Key' => 'Name',
    +            'Value' => sprintf('subnet-random-data #%d - %s - %s', $num, date('Y/m/d H:i:s'), $this->random->name(32, TRUE)),
    +          ],
    +        ],
    +      ];
    +    }
    +
    +    return $subnets;
    +  }
    
  2. This code should be deleted from OpenStackNetworkInterfaceTest, and Drupal\Tests\aws_cloud\Functional\Ec2\NetworkInterfaceTest::updateSubnetsToMockData() should be moved into Drupal\Tests\aws_cloud\Traits\AwsCloudTestMockTrait.
    +++ b/modules/cloud_service_providers/openstack/tests/src/Functional/OpenStack/OpenStackNetworkInterfaceTest.php
    @@ -0,0 +1,410 @@
    
    +  /**
    +   * Update VPCs and subnets to mock data.
    +   *
    +   * @param array $subnets
    +   *   The subnets array.
    +   */
    +  private function updateSubnetsToMockData(array $subnets): void {
    +    $mock_data = $this->getMockDataFromConfig();
    +    $mock_data['DescribeSubnets']['Subnets'] = $subnets;
    +    $this->updateMockDataToConfig($mock_data);
    +  }
    +
    +}
    
jigish.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new31.88 KB
new4.37 KB

@yas

Thank you for reviewing the patch.

I changed the code as per your comment.

Please review updated patch.

Thanks

yas’s picture

Status: Needs review » Needs work
StatusFileSize
new6.13 MB

@jigishaddweb

Unfortunately all tests have not been passed successfully. Probably that's the system's failure. I'll re-test it.

6262.png

yas’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new3.9 MB
new1.21 MB

@jigishaddweb

Thank you for the update. Now the tests are passed successfully. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

6279.png
6264.png

yas’s picture

Status: Reviewed & tested by the community » Needs work

@jigishaddweb

Could you please re-create the patch? I had the following error while merging the patch:

error: patch failed: modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/CloudServerTemplateTest.php:3
error: modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/CloudServerTemplateTest.php: patch does not apply
error: patch failed: modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/InstanceTest.php:2
error: modules/cloud_service_providers/aws_cloud/tests/src/Functional/Ec2/InstanceTest.php: patch does not apply
jigish.addweb’s picture

Status: Needs work » Needs review
StatusFileSize
new31.95 KB

@yas

Thank you for testing the patch.

I recreated the patch. Please review new patch.

Thanks

yas’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.77 MB
new1.13 MB

@jigishaddweb

Thank you for the update. Now it looks good. I'll merge the patch to 8.x-1.x and 8.x-2.x and close this issue as Fixed.

6918.png
6920.png

  • yas committed 2789eb6 on 8.x-1.x authored by jigish.addweb
    Issue #3124064 by jigish.addweb, nilesh.addweb, yas: Add test cases for...

  • yas committed 8912149 on 8.x-2.x authored by jigish.addweb
    Issue #3124064 by jigish.addweb, nilesh.addweb, yas: Add test cases for...
yas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.