Skip to content
Snippets Groups Projects
Commit 49760f55 authored by Kumiko Ono's avatar Kumiko Ono Committed by Yas Naoi
Browse files

Issue #3254463 by kumikoono, yas: Support random string in preprocessing Behat test feature files

parent df5ee177
No related branches found
No related tags found
No related merge requests found
# This file is processed by drush cloud:behat:preprocess.
# '_random_' is a reserved term to be replaced by a random string in lowercase.
# '_Random_' is in mixed cases, and '_RANDOM_' is in uppercase.
# '@Random' is a reserved term to be replaced by a random string.
# '@random' is in lower cases, and '@RANDOM' is in uppercase.
account_id:
# Need to set your AWS account id.
......@@ -8,11 +8,12 @@ account_id:
avail_zone:
us-west-1a
cloud_context:
bdd_random_aws_us_west_1
# The region is automatically set as suffix.
bdd_aws_@random_us_west_1
cloud_service_provider_name_entered:
BDD_Random_AWS
BDD_AWS_@Random
cloud_service_provider_name:
BDD_Random_AWS (N. California)
BDD_AWS_@Random (N. California)
description:
Created by behat
image_id:
......@@ -30,20 +31,20 @@ region_code:
region_name:
US West (N. California)
role_name:
BDD_Random_Role
BDD_Role_@Random
role_name_machine:
bdd_random_role
bdd_role_@random
security_group_name:
BDD_Random_SG
BDD_SG_@Random
ssh_key_name:
BDD_Random_Key
BDD_Key_@Random
status:
Review
subnet_name:
BDD_Random_Subnet
BDD_Subnet_@Random
instance_name:
BDD_Random_Instance
BDD_Instance_@Random
vpc_name:
BDD_Random_VPC
BDD_VPC_@Random
wait:
500
......@@ -152,11 +152,11 @@ class BehatCommands extends DrushCommands implements BehatCommandsInterface {
private function randomizeName(array &$params): void {
$random = (new Random())->name(self::RANDOM_NAME_LENGTH);
foreach ($params as $key => $value) {
if (preg_match('/(^.*_)(random)(_.*$)/i', $value, $matches)) {
if ($matches[2] === 'random') {
if (preg_match('/(^.*)(@random)(.*$)/i', $value, $matches)) {
if ($matches[2] === '@random') {
$rand = strtolower($random);
}
elseif ($matches[2] === 'RANDOM') {
elseif ($matches[2] === '@RANDOM') {
$rand = strtoupper($random);
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment