测试厨房是否支持运行多个特定套件?

时间:2017-01-17 17:35:50

标签: test-kitchen

例如,如果我的kitchen.yml包含这三个套件(示例缩写):

suites:
  - name: dogs
  - name: cats
  - name: horse

我希望能够运行:

kitchen converge -c 2 dogs cats

这可能吗?

1 个答案:

答案 0 :(得分:2)

test-kitchen支持同时运行多个套件。您可以使用正则表达式“REGEXP”模式匹配要运行的套件。

$ kitchen help converge
  Usage:
    kitchen converge [INSTANCE|REGEXP|all]

  Options:
    -c, [--concurrency=N]                        # Run a converge against all matching instances concurrently. Only N instances will run at the same time if a number is given.
    -p, [--parallel], [--no-parallel]            # [Future DEPRECATION, use --concurrency] Run a converge against all matching instances concurrently.
    -t, [--test-base-path=TEST_BASE_PATH]        # Set the base path of the tests
    -l, [--log-level=LOG_LEVEL]                  # Set the log level (debug, info, warn, error, fatal)
        [--log-overwrite], [--no-log-overwrite]  # Set to false to prevent log overwriting each time Test Kitchen runs
        [--color], [--no-color]                  # Toggle color output for STDOUT logger

  Description:
    The instance states are in order: destroy, create, converge, setup, verify, destroy. Change one or more instances
    from the current state to the converge state. Actions for all intermediate states will be executed. See
    http://kitchen.ci for further explanation.

因此,您可以使用以下正则表达式模式匹配“狗”和“猫”套房,并让厨房运行它们。其后没有数字的“-c”选项将同时运行与正则表达式匹配的所有套件。

kitchen converge 'dogs|cats' -c

“ - p”选项也会与“-c”具有相同的行为,后面没有任何数字。

希望有所帮助。