ソースを参照

Let the AWS integration suite use a configured test image

The AWS matrix cell was the only one not given a CB_IMAGE_* secret, so it
fell back to the default in tests/helpers - ami-aa2ea6d0, which exists to
match an entry in custom_amis.json so moto can resolve it. That is
Canonical's Ubuntu 16.04 image built in 2017, a Xen-era HVM AMI, and the
AWS suite's wall time is dominated by exactly the operations an old
Xen-era image is slow at: launching an instance, snapshotting it into an
AMI, launching a second instance from that AMI, and stop/start cycling.

In the 4.3.1 release run, test_create_and_list_image took 26.2 minutes of
a 26.3 minute suite - it starts first and every other worker is idle for
the last 20 minutes of it - so the suite's floor is that one test, and no
scheduling or concurrency change can move it.

Wire CB_IMAGE_AWS through as the other providers already do, and record
on the default what it is for, so a run against real EC2 does not silently
inherit a moto fixture. Setting the secret to a current Nitro-compatible
image is the actual change; this makes it possible.
Nuwan Goonasekera 15 時間 前
コミット
7d589a1399
2 ファイル変更7 行追加1 行削除
  1. 1 0
      .github/workflows/integration-cloud.yaml
  2. 6 1
      tests/helpers/__init__.py

+ 1 - 0
.github/workflows/integration-cloud.yaml

@@ -110,6 +110,7 @@ jobs:
           # cell that needs it. Limits blast radius if a single cell is
           # compromised.
           # aws — credentials supplied via the OIDC step above
+          CB_IMAGE_AWS: ${{ matrix.cloud-provider == 'aws' && secrets.CB_IMAGE_AWS || '' }}
           CB_VM_TYPE_AWS: ${{ matrix.cloud-provider == 'aws' && secrets.CB_VM_TYPE_AWS || '' }}
           # azure
           AZURE_CLIENT_ID: ${{ matrix.cloud-provider == 'azure' && secrets.AZURE_CLIENT_ID || '' }}

+ 6 - 1
tests/helpers/__init__.py

@@ -81,7 +81,12 @@ def skipIfPython(op, major, minor):
 
 TEST_DATA_CONFIG = {
     "AWSCloudProvider": {
-        # Match the ami value with entry in custom_amis.json for use with moto
+        # This default exists for the mock provider only - it matches an entry
+        # in custom_amis.json so moto can resolve it. It is Ubuntu 16.04 built
+        # in 2017, a Xen-era HVM image, and launching, imaging and stop/start
+        # cycling it against real EC2 is markedly slower than a current
+        # Nitro-compatible image. Runs against real AWS should set
+        # CB_IMAGE_AWS, as the other providers' suites set their CB_IMAGE_*.
         "image": cb_helpers.get_env('CB_IMAGE_AWS', 'ami-aa2ea6d0'),
         "vm_type": cb_helpers.get_env('CB_VM_TYPE_AWS', 't2.nano'),
         "placement": cb_helpers.get_env('CB_PLACEMENT_AWS', 'us-east-1a'),