Red Hat Training

A Red Hat training course is available for Red Hat OpenStack Platform

6.2. コンテナー内でコンテナー化された Tempest の実行

  1. コンテナー内で実行できる tempest スクリプトを作成して tempest.conf ファイルを生成し、tempest テストを実行します。スクリプトは以下のアクションを実行します。

    • コマンド set -e の終了ステータスを設定します。
    • オーバークラウドに対して tempest を実行する場合には、source コマンドで overcloudrc ファイルを読み込みます。アンダークラウドに対して tempest を実行する場合には、source コマンドで stackrc ファイルを読み込みます。
    • tempest init を実行して tempest ワークスペースを作成します。共有ディレクトリーを使用して、ホストからもファイルにアクセスできるようにします。
    • ディレクトリーを tempest_workspaceに変更します。
    • 後で簡単に使用できるように、TEMPESTCONF 環境変数をエクスポートします。
    • discover-tempest-config を実行して tempest.conf ファイルを生成します。discover-tempest-config コマンドで追加するオプションの詳細は、discover-tempest-config --help を実行します。
    • --outhome/stack/tempest_workspace/tempest.conf に設定して、ホストマシンから tempest.conf ファイルにアクセスできるようにします。
    • --deployer-input を設定して、共有ディレクトリーの tempest-deployer-input.conf ファイルを参照します。
    • tempest テストを実行します。このサンプルスクリプトは、smoke テスト tempest run --smoke を実行します。

      $ cat <<'EOF'>> /home/stack/container_tempest/tempest_script.sh
      set -e
      source /home/stack/container_tempest/overcloudrc
      tempest init /home/stack/tempest_workspace
      pushd /home/stack/tempest_workspace
      
      export TEMPESTCONF="/usr/bin/discover-tempest-config"
      
      $TEMPESTCONF \
        --out /home/stack/tempest_workspace/etc/tempest.conf \
        --deployer-input /home/stack/container_tempest/tempest-deployer-input.conf \
        --debug \
        --create \
        object-storage.reseller_admin ResellerAdmin
      
      tempest run --smoke
      
      EOF

      tempest.conf ファイルがすでにあり、tempest テストのみを実行する場合は、スクリプトから TEMPESTCONF を省略し、container_tempest ディレクトリーから tempest_workspace/etc ディレクトリーに tempest.conf ファイルをコピーするコマンドに置き換えます。

    $ cp /home/stack/container_tempest/tempest.conf /home/stack/tempest_workspace/etc/tempest.conf
  2. tempest_script.sh スクリプトに実行可能権限を設定します。

    $ chmod +x container_tempest/tempest_script.sh
  3. 前のステップで作成したエイリアスを使用して、コンテナーから tempest スクリプトを実行します。

    $ docker-tempest -c 'set -e; /home/stack/container_tempest/tempest_script.sh'
  4. .stestr ディレクトリーでテスト結果に関する情報を検査します。
  5. tempest テストを再実行する場合は、最初に tempest ワークスペースを削除し、再作成する必要があります。

    $ sudo rm -rf /home/stack/tempest_workspace
    $ mkdir /home/stack/tempest_workspace