Tests relying on .bashrc being loaded not working
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- bash, docker
- Lĩnh vực
- testing-qa, tooling
Hướng nghiên cứu
Bắt đầu với luồng thực thi commandTests và hành vi của setup entrypoint được mô tả trong issue, sử dụng Debian Dockerfile và các trường hợp YAML được cung cấp làm bộ tái hiện. So sánh cách xử lý môi trường đối với các lệnh trực tiếp, bash -c, việc source .bashrc và các setup entrypoints; hoàn tất khi các kiểm thử liên quan nhất quán quan sát thấy FOO=BAR.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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 :(
- Ngôn ngữ chính
- Go
- Star
- 2.5k
- Fork
- 213
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GoogleContainerTools/container-structure-test
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
allstar
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
GoogleContainerTools/container-structure-test#393 · 639 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
GoogleContainerTools/container-structure-test#280 · 1 reaction ·
-
go.mod pins vulnerable docker/containerd modules; two open Dependabot PRs clear most findingsĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Windows: structure_test binary missing .exe extension causes "Open With" dialog instead of running testsCó thể đã có người làm @peakschris đã nhận 144 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Tất cả issue của GoogleContainerTools/container-structure-test
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Energy flow: add an "Other" row so the consumers add up to the consumption totalCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
evcc-io/evcc#35512 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nebari-dev/nebi#630 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
router-for-me/CLIProxyAPI#7084 ·
Maintainer thường phản hồi trong vòng 1 ngày