Tests relying on .bashrc being loaded not working
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- bash, docker
- 領域
- testing-qa, tooling
調査の方向性
issue に記載されている commandTests の実行パスと setup entrypoint の動作から始め、提供された Debian Dockerfile と YAML ケースを再現手段として使用します。直接コマンド、bash -c、.bashrc の source、setup entrypoints における環境の扱いを比較します。関連するテストが一貫して FOO=BAR を確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi all.
First of all... great library, really like the simplicity of it.
We have a fairly rich docker container that makes heavy use of bash scripting to dynamically define env variables in the ~/,bashrc. After trying all kind of things for the last days I cannot get container structure tests to work in the context of the bashrc. Whatever I do, the env vars seem to be undefined.
Here's an example Dockerfile I wrote up:
FROM debian:buster
RUN echo "export FOO=BAR" >> /root/.bashrc
RUN echo "echo 'bashrc loaded!'" >> ~/.bashrc
# this is strictly seen not necessary, but it forces the bashrc to be always loaded, not just in interactive mode and suppresses a related warning:
ENV BASH_ENV=/root/.bashrc
These are my example tests - they all fail.
The output indicates that the .bashrc is actually loaded, but the actual test seems to run separately under a different context - FOO seems never defined in the test context and the output of $FOO is always blank.
schemaVersion: 2.0.0
commandTests:
- name: "echo FOO"
command: echo
args: [ "$FOO" ]
expectedOutput: [ "BAR" ]
- name: "echo FOO using bash -c wrapper and enumerated args"
command: "bash"
args:
- -c
- "echo $FOO"
expectedOutput: [ "BAR" ]
- name: "echo FOO using bash -c wrapper and string array args"
command: "bash"
args: ["-c", "echo $FOO"]
expectedOutput: [ "BAR" ]
- name: "echo FOO using bash -c wrapper, pipe and source .bashrc"
command: "bash"
args:
- -c
- |
source ~/.bashrc &&
echo $FOO
expectedOutput: [ "BAR" ]
I also tried to specify a custom entry point using setup: [["entrypoint.sh"]] with the same result.
entrypoint.sh:
#!/bin/bash
source /root/.bashrc
Any help is greatly appreciated!
We already wrote fair a bit of non-bash tests, but cannot use this framework without proper bash support :(
- 主要言語
- Go
- スター
- 2.5k
- フォーク
- 213
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GoogleContainerTools/container-structure-test のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
allstar
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
GoogleContainerTools/container-structure-test#393 · コメント 639 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
GoogleContainerTools/container-structure-test#280 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
Windows: structure_test binary missing .exe extension causes "Open With" dialog instead of running tests対応中かも @peakschris が 145 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
GoogleContainerTools/container-structure-test の issue をすべて見る
似ている issue
-
bug converter
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
grafana/sigma-rule-deployment#435 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
google/go-containerregistry#2491 ·
メンテナーはふだん 1 日以内に返信
-
type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
nightgauge/nightgauge#2688 ·
メンテナーはふだん 1 日以内に返信
-
aiac enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信