Skip to content

Unexpected error when using setup with bash shell (but ok with sh) #82

@CyberPQ

Description

@CyberPQ

Hello,
A have a test scenario with a setup function:

Describe "Problem SSH during setup"

    setup() {
        ssh -o ConnectTimeout=2 -q root@192.168.0.32 'touch /tmp/foo.txt'
    }

    teardown() {
        ssh -q root@192.168.0.32 'rm -f /tmp/foo.txt'
    }

    BeforeAll setup
    AfterAll  teardown

    Describe "Ability to check file in temp dir"

        It "File foo.txt exist"
            When run ssh -o ConnectTimeout=2 -q root@192.168.0.32 '[ -e /tmp/foo.txt ]'
            The status should be success
        End

    End

End

When using this file with sh shell (./shellspec -s /bin/sh test_spec.sh), the restult is OK:

Running: /bin/sh [sh]

Problem SSH during setup
  Ability to check file in temp dir
    File foo.txt exist

Finished in 0.62 seconds (user 0.06 seconds, sys 0.21 seconds)
1 example, 0 failures

But when using this file with bash shell (./shellspec -s /bin/bash test_spec.sh), the restult is OK (the expectation is green), but the execution ended with an unexpected error. I do not understand why...

Running: /bin/bash [bash 4.4.20(1)-release]

Problem SSH during setup
  Ability to check file in temp dir
    File foo.txt exist

Finished in 0.70 seconds (user 0.09 seconds, sys 0.17 seconds)
1 example, 0 failures, aborted by an unexpected error

An unexpected error occurred. [executor: 0] [reporter: 1] [error handler: 0]
Fatal error occurred, terminated with exit status 1.

I am running shellspec version 0.24.3.

Thank you !

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions