Skip to content

bats v1.2.1 testing issue - preserve exported bash functions #17

Closed
@psellars-hyprnz

Description

@psellars-hyprnz

I am trying to test a dojo image and when I run bats am seeing the following issue

 ✗ hadolint
   (from function `assert_equal' in file /opt/bats-assert/src/assert_equal.bash, line 40,
    in test file test/integration/test.bats, line 7)
     `assert_equal "$status" 0' failed
   output: 2020/08/10 01:49:52 [ 1]  INFO: (main.main) Dojo version 0.8.0
   2020/08/10 01:49:52 [ 7]  INFO: (main.DockerDriver.HandleRun) docker command will be:
    docker run --rm -v /home/cato/Code/docker-docker-image-dojo:/dojo/work -v /home/cato:/dojo/identity:ro -v /tmp/dojo-environment-multiline-dojo-docker-docker-image-dojo-2020-08-10_01-49-52-67789255:/etc/dojo.d/variables/00-multiline-vars.sh --env-file=/tmp/dojo-environment-dojo-docker-docker-image-dojo-2020-08-10_01-49-52-67789255 -v /tmp/.X11-unix:/tmp/.X11-unix --name=dojo-docker-docker-image-dojo-2020-08-10_01-49-52-67789255 catosplace/docker-docker-image-dojo:latest "hadolint --version"
   09-08-2020 13:49:52 Dojo entrypoint info: Sourcing: /etc/dojo.d/variables/00-multiline-vars.sh
   /etc/dojo.d/variables/00-multiline-vars.sh: line 1: export: `DOJO_BASH_FUNC_bats_readlinkf%%=()': not a valid identifier
   /etc/dojo.d/variables/00-multiline-vars.sh: line 1: export: `{': not a valid identifier
   /etc/dojo.d/variables/00-multiline-vars.sh: line 1: export: `-f': not a valid identifier
   /etc/dojo.d/variables/00-multiline-vars.sh: line 1: export: `"$1"': not a valid identifier
   /etc/dojo.d/variables/00-multiline-vars.sh: line 1: export: `}': not a valid identifier
   
   -- values do not equal --
   expected : 0
   actual   : 1
   --

Wondering if anyone may be able to shed some light on this - when I dojo into the container the file is empty, and when I run the command using dojo "hadolint --version" it works fine. Only difference is running it using bats from CLI in test.

Am using bats version 1.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions