There some hard coding property values in the files mock_data/**/*.yml. It should be replaced with random data.

Comments

Xiaohua Guan created an issue. See original summary.

xiaohua guan’s picture

StatusFileSize
new72.27 KB
xiaohua guan’s picture

I've randomized the data in yml files, and removed useless files, uncommented test cases of deleting.

xiaohua guan’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 3010193_20181030.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

yas’s picture

@xiaohua-guan Thank you for your patch.

Just my two cents, how about this one to create the random IP addresses as follows?

For the following YAML properties,

PublicIpAddress: {{public_ip_address}}
PrivateDnsName: {{private_dns_name}}
CidrBlock: {{cidr_block}}

You can create the random IP addresses as follows (I haven't tested, so please make sure if it works or not)

public_ip = implode('.', [rand(0, 254), rand(0, 255), rand(0, 255), rand(1, 255)]);

private_ip = array_rand([
  implode('.', ['10',  rand(0,  255), rand(0, 255), rand(1, 255)]),
  implode('.', ['172', rand(16,  31), rand(0, 255), rand(1, 255)]),
  implode('.', ['192', '168'        , rand(0, 255), rand(1, 255)]),
]);

cidr_block = array_rand([
  implode('.', ['10' , rand(0,  255), rand(0, 255), rand(1, 255)]) . '/8' ,
  implode('.', ['172', rand(16, 31) , '0'         , '0'         ]) . '/16',
  implode('.', ['192', '168'        , rand(0, 255), '0'         ]) . '/24',
]);
xiaohua guan’s picture

StatusFileSize
new74.03 KB
xiaohua guan’s picture

xiaohua guan’s picture

@yas

Thanks for your comment.

I modified the code related to private ip, public ip and cidr as the way you showed. And I also move such code to a new class Utils.

Please confirm the patch file 3010193_20181031.patch.

yas’s picture

@xiaohua-guan Thank you for the modification. It looks good to me.

baldwinlouie’s picture

Status: Needs work » Reviewed & tested by the community

@xiaohua-guan and @yas, This patch looks good! Moving to RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: 3010193_20181031.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • yas committed 0ec5a47 on 8.x-1.x authored by Xiaohua Guan
    Issue #3010193 by Xiaohua Guan, yas, baldwinlouie: Randomize the test...
yas’s picture

Status: Needs work » Fixed

@xiaohua-guan and @baldwinlouie Thank you for your contributions. We mark this issue as 'Fixed'.

Status: Fixed » Closed (fixed)

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