Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Having two SpawnGeneric, each with different verbosity configuration #80

@oshoval

Description

@oshoval

Hi
We are using goexpect at https://github.com/kubevirt/kubevirt [1]
With the following settings to SpawnGeneric:

opts = append(opts, expect.Verbose(true))
opts = append(opts, expect.VerboseWriter(GinkgoWriter))

[1] https://github.com/kubevirt/kubevirt/blob/75674879e91dfc24a340cae54c92ea7509e42cb4/tests/console/console.go#L209

On one hand it is perfect for us that only upon error or verbose mode, we see all the logged info.
The problem is that if there is an error, we have a custom error reporter, which also uses SpawnGeneric
in order to trigger some more commands that collect data.
Those commands would print as well all the collected info to the console, which cause it to be too loaded with info
which is not needed (it is saved to files as well where it belongs).

Is there a way to have two SpawnGeneric, where one prints to GinkgoWriter, while the other prints to /dev/null
or doesn't print at all ?

Tried few configurations, but no luck yet (changes might be required in the NewExpecter as well i believe)
For example tried to have a different buffer and control it (I believe I didn't do it right if it suppose to work)

Thanks

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