Disable Amazee AI auto-trial provisioning in drupal_cms_ai tests
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3569627. -->
Reported by: [mxr576](https://www.drupal.org/user/315522)
Related to !802 !785
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>It looks like now that <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/drupal_cms/-/work_items/3567008" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/drupal_cms/-/work_items/3567008</a></span> got resolved the drupal_cms_ai recipe (maybe others as well?) tries to auto privisioning trial access on Amazee AI which could lead to flaky tests and many unwanted trial accounts on Amazee's end.</p>
<p><details><br>
<summary>Test execution output</summary></details></p>
<pre>Process exit code mismatch.<br>Expected: 0<br>Actual: 1<br><br>STDOUT:<br>Provisioning amazee.ai trial account...<br> 0% [>---------------------------] Waiting for API response...<br> 14% [->--------------------------] Waiting for API response...<br> 18% [--->------------------------] Waiting for API response...<br> 22% [----->----------------------] Waiting for API response...<br> 26% [------->--------------------] Waiting for API response...<br> 30% [--------->------------------] Waiting for API response...<br> 34% [----------->----------------] Waiting for API response...<br> 38% [------------->--------------] Waiting for API response...<br> 42% [-------------->-------------] Waiting for API response...<br> 46% [---------------->-----------] Waiting for API response...<br> 50% [------------------>---------] Waiting for API response...<br> 54% [-------------------->-------] Waiting for API response...<br> 58% [---------------------->-----] Waiting for API response...<br> 62% [------------------------>---] Waiting for API response...<br> 66% [-------------------------->-] Waiting for API response...<br> 70% [>---------------------------] Waiting for API response...<br> 74% [->--------------------------] Waiting for API response...<br> 78% [--->------------------------] Waiting for API response...<br> 82% [----->----------------------] Waiting for API response...<br> 86% [------->--------------------] Waiting for API response...<br> 90% [--------->------------------] Waiting for API response...<br> 94% [----------->----------------] Waiting for API response...<br> 98% [------------->--------------] Waiting for API response...<br> 102% [-------------->-------------] Waiting for API response...<br> 106% [---------------->-----------] Waiting for API response...<br> 110% [------------------>---------] Waiting for API response...<br> 114% [-------------------->-------] Waiting for API response...<br> 118% [---------------------->-----] Waiting for API response...<br> 122% [------------------------>---] Waiting for API response...<br> 126% [-------------------------->-] Waiting for API response...<br> 130% [>---------------------------] Waiting for API response...<br> 134% [->--------------------------] Waiting for API response...<br>Failed: cURL error 28: Operation timed out after 30000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.amazee.ai/auth/generate-trial-access<br><br><br>STDERR:<br> 0/13 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]<br>Applying recipe<br><br> 2/13 [▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░]<br>Applied Content editor role recipe.<br><br> 4/13 [▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░]<br>Applied Content editor role recipe.<br><br> 7/13 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░]<br>Installed configuration for Content Basics recipe.<br><br> 8/13 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░]<br>Applied Content Basics recipe.<br><br>10/13 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░]<br>Created content for Basic Privacy recipe.<br><br>In EnsureAmazeeAiAccess.php line 58:<br> <br> cURL error 28: Operation timed out after 30000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl <br> /c/libcurl-errors.html) for https://api.amazee.ai/auth/generate-trial-access <br> <br><br>In TrialAccountProvisioner.php line 194:<br> <br> cURL error 28: Operation timed out after 30000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl <br> /c/libcurl-errors.html) for https://api.amazee.ai/auth/generate-trial-access <br> <br><br>In CurlFactory.php line 277:<br> <br> cURL error 28: Operation timed out after 30000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl <br> /c/libcurl-errors.html) for https://api.amazee.ai/auth/generate-trial-access <br> <br><br>recipe [-i|--input INPUT] [--] <path><br><br><br>Failed asserting that 1 is identical to 0.<br>/var/www/html/web/core/tests/Drupal/FunctionalTests/Core/Recipe/RecipeTestTrait.php:71<br>/var/www/html/recipes/drupal_cms_ai/tests/src/Functional/ComponentValidationTest.php:96</pre><p>
</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>By swapping the trial provisioner service <a href="https://git.drupalcode.org/project/ai_provider_amazeeio_recipe/-/blob/1.2.x/tests/src/Funtional/RecipeApplicationTest.php?ref_type=heads#L35">the same way I did we can in the ai_provider_amazeeio_recipe</a> we could mitigate this problem, however that was<a href="https://git.drupalcode.org/project/ai_provider_amazeeio_recipe/-/blob/1.2.1/composer.json?ref_type=tags#L21"> a duct taped solution</a>, <a href="https://drupal.slack.com/archives/C2THUBAVA/p1767958362377809">since recipes cannot contain code,</a> not even for test fixtures. </p>
<p>So we probably need better alternatives, like:<br>
1. The test fixture module from the recipe could be moved to the ai_provider_amazeeio module and unprecedentedly could become part of its public API that recipes can depend on. (Catch 22 that as a recipe author you have to know that you need to enabled this test fixture in your tests.)<br>
2. Since recipes trigger trial key provisioning via the <code>ensureAmazeeAiAccess</code> config action, we may add a check to that config action whether it is triggered in a SUT context and do nothing. Coupling a code with a environment check in this level could be acceptable, better than doing similar in TrialAccessProvisioner service.<br>
3. ... ?</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<h3 id="summary-data-model-changes">Configuration changes</h3>
> Related issue: [Issue #3567008](https://www.drupal.org/node/3567008)
> Related issue: [Issue #3569665](https://www.drupal.org/node/3569665)
issue