Skip to content
Snippets Groups Projects
Commit d1fc4f72 authored by Yas Naoi's avatar Yas Naoi Committed by Yas Naoi
Browse files

Issue #3218525 by yas, Masami: Shorten the test time

parent 835ccbab
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ class CloudServerTemplateTest extends K8sTestBase {
use CloudServerTemplateTrait;
public const CLOUD_SERVER_TEMPLATES_REPEAT_COUNT = 2;
public const CLOUD_SERVER_TEMPLATES_MAX_OBJECT_COUNT = 10;
private const CLOUD_SERVER_TEMPLATES_OPERATION_ADD = 'add';
private const CLOUD_SERVER_TEMPLATES_OPERATION_EDIT = 'edit';
......@@ -280,12 +281,21 @@ class CloudServerTemplateTest extends K8sTestBase {
*
* @throws \Behat\Mink\Exception\ExpectationException
* @throws \Behat\Mink\Exception\ResponseTextException
* @throws \Exception
*/
private function runServerTemplateLaunchTest(): void {
$cloud_context = $this->cloudContext;
$objects = \Drupal::service('k8s')->supportedCloudServerTemplates();
// Pick up several $objects randomly to shorten the test time.
$objects = array_intersect_key($objects, array_flip(
array_rand(
$objects, random_int(2, self::CLOUD_SERVER_TEMPLATES_MAX_OBJECT_COUNT)
)
));
foreach ($objects as $object => $name) {
$count = random_int(1, self::CLOUD_SERVER_TEMPLATES_REPEAT_COUNT);
$createFormDataFunction = "create{$name}TestFormData";
if (!method_exists($this, $createFormDataFunction)) {
......@@ -459,7 +469,6 @@ class CloudServerTemplateTest extends K8sTestBase {
}
$this->assertSession()->linkNotExists($this->namespaces[0]);
$this->assertSession()->linkExists($this->namespaces[1]);
}
}
}
......@@ -787,8 +796,8 @@ class CloudServerTemplateTest extends K8sTestBase {
}
$mock_data['getNamespaces'][] = $namespace;
}
parent::updateMockDataToConfig($mock_data);
parent::updateMockDataToConfig($mock_data);
}
}
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