Skip to content

E2E CLI, improve parallelization and test cache

Matteo Melli requested to merge e2e-improve-parallelization-and-test-cache into main

Before parallelization improvements the e2e tests run a batch in parallel. Now all the e2e tests are run in parallel using a thread pool (powered by xargs command and named pipe file 😉).

Test cache is now much more optimized. The only drawback is that you have to specify the extra hash in the e2e_test_extra_hash function and if you change any file in stackgres-k8s/e2e or stackgres-k8s/e2e/utils folder the hash will not be updated (but you can still add the hash of the utils changed or add some revision to the output of the e2e_test_extra_hash function in your test.

Also here is the CLI with autocompletion (bash required):

$ sh stackgres-k8s/e2e/cli
Type e2e<tab> to get started. Use --help for more info.
$ e2e
build  pull   push   test
$ e2e

e2e [<option> ...] [<phase> ...] [-- [<test spec> ...]]

If no <test spec> is specified all the e2e tests under stackgres-k8s/e2e/spec
 will be executed.
The "<test spec>" are files that can be found under stackgres-k8s/e2e/spec but
 you may specify the file name in such folder or the relative path

Phases:

  test: run e2e tests, the if no phase is specified
  pull: pull images from repositories
  build: build operator images
  push: push operator images to repositories

Options:

  --help:                 Print this help and exit
  --debug:                Print shell xtrace to debug the E2E framework
  --use-cache:            Enable test cache used to store test results
  --excluded-tests <test> [<test> ...]: Specify the list of tests or test's paths to exclude from running
  --retry <number>:       Specify the number of retries for failed tests. If
                           not specified, failed tests will not be retried
  --parallelism <number>: Specify the parallelism that will be used for
                           running multiple e2e tests in parallel (when
                           possible) and other operations
  --env <environment>:    Allow to use one of the k8s environment present in
                           the folder stackgres-k8s/e2e/envs
  --reset-env:            Specify that the k8s environment have to be
                           recreated if it already exists
  --native-image-tag <tag>: Specify the native image tag to use for the
                           operator images
  --image-tag <tag>:      Specify the JVM image tag to use for the operator
                           images
  --reuse-operator:       Reuse an already installed operator
  --skip-spec-uninstall:  Skip uninstallation after spec to allow post inspections
  --skip-operator-install: Skip installation of the operator
  --upgrade-from-previous-operator: Upgrade from a previous version of the
                           operator
  --target-version:       The supported target version used to create StackGres CR
  --previous-operator-version: Set the previous version of the operator to test
  --pull-policy <policy>: Set the pull policy for the operator images
  --skip-load-operator:   Skip loading of the operator images
  --enable-image-cache:   Enable image cache
  --images-map <transformation> [<transformation> ...]: A list of transformations that will be performed to loaded images.
                          Each transformation is a sed expression and a value separated by an equal `=`. If the image name
                          or substring of the image name that are loaded match the sed expression it will be replaced by the
                          transformation value. So that the resulting image name will be loaded instead and finally tagged as
                          the image name that was going to be loaded. For example:

                          postgres-util:v15\.0-build-6\.17=postgres-util:v15.0-hash-f9b66c957b5e1ff5b59f0310e9a23f38-linux-amd64

                          Will load image with name postgres-util:v15.0-hash-f9b66c957b5e1ff5b59f0310e9a23f38-linux-amd64
                          as it where the image with name postgres-util:v15.0-build-6.17.
  --enable-k8s-logging:   Enable logging of k8s resources
  --enable-pod-logging:   Enable logging of pod resources
  --enable-resource-logging: Enable logging of resources by wathing them
  --load-components:      Load component images
  --load-extensions:      Load extension images
  --operator-public-registry <registry>: The public image registry for the
                           operator that will be used during the installation
                           of the operator
  --components-public-registry <registry>: The public image registry for the
                           components that will be used by the operator
  --operator-registry <registry>: The image registry that will be used to pull
                           operator images
  --components-registry <registry>: The image registry that will be used to
                           pull component images
  --extensions-registry <registry>: The extension registry that will be used to
                           pull extensions images
  --extensions-repository-url <url>: The extensions repository URL
  --cluster-parameters <parameters>: Extra helm chart parameters for cluster
  --enable-cluster-resource-requirements: Enable cluster resource requirements
Edited by Matteo Melli

Merge request reports

Loading