Tests relying on .bashrc being loaded not working
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- bash, docker
- Ambito
- testing-qa, tooling
Direzione di ricerca
Inizia con il percorso di esecuzione di commandTests e il comportamento del setup entrypoint descritto nell’issue, utilizzando il Debian Dockerfile e i casi YAML forniti come riproduttore. Confronta la gestione dell’ambiente per i comandi diretti, bash -c, il sourcing di .bashrc e i setup entrypoints; il lavoro è completato quando i test pertinenti osservano costantemente FOO=BAR.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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 :(
- Lingua principale
- Go
- Stelle
- 2.5k
- Fork
- 213
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di GoogleContainerTools/container-structure-test
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
allstar
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
GoogleContainerTools/container-structure-test#393 · 639 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
GoogleContainerTools/container-structure-test#280 · 1 reazione ·
-
go.mod pins vulnerable docker/containerd modules; two open Dependabot PRs clear most findingsAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
-
Windows: structure_test binary missing .exe extension causes "Open With" dialog instead of running testsForse già presa @peakschris l’ha presa 144 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
Tutte le issue di GoogleContainerTools/container-structure-test
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
agent-butler-finding bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jordansmall/spindrift#6161 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
open-telemetry/opentelemetry-go-compile-instrumentation#1635 ·
I maintainer di solito rispondono entro 2 giorni
-
C-bug O-community X-blathers-untriaged
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
cockroachdb/cockroach#176210 · 1 commento ·
-
VLAgent `spec.k8sCollector.includePodLabels: false` has no effectForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
VictoriaMetrics/operator#2772 ·
I maintainer di solito rispondono entro 1 giorno