Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace is not outputted when --output=table #1031

Open
tonglil opened this issue Dec 19, 2024 · 2 comments
Open

Trace is not outputted when --output=table #1031

tonglil opened this issue Dec 19, 2024 · 2 comments

Comments

@tonglil
Copy link

tonglil commented Dec 19, 2024

As of v0.55.0, the CONFTEST_TRACE env var does not seem to set the conftest test --trace flag.

I expected the trace to still be displayed even if the output is set to something else.

@thevilledev
Copy link
Contributor

Could not reproduce this on v0.55.0 or v0.56.0 (latest) on macOS 15.2. These commands produce identical output, sometimes in different order:

$ CONFTEST_TRACE=true conftest test examples/kubernetes/service.yaml -p examples/kubernetes/policy

$ conftest test --trace examples/kubernetes/service.yaml -p examples/kubernetes/policy

Looking at the code:

  • internal/commands/default.go sets the env var prefix correctly
  • internal/commands/test.go binds flagname trace correctly
  • TestRunner struct in runner/test.go has a Trace field, and Viper binds struct fields to variables case-insensitively. Even though the struct tag mapstructure:"trace" is missing I think this should work.

Which environment was this failing on?

@tonglil
Copy link
Author

tonglil commented Jan 27, 2025

Thanks for diving into this @thevilledev.

Upon closer inspection, I was setting the output flag to table, which seems to override trace, which I did not expect and falsely attributed to the flag not working.

@tonglil tonglil changed the title CONFTEST_TRACE env var does not set --trace flag CONFTEST_TRACE env var / --trace flag is not respected when --output=table Jan 29, 2025
@tonglil tonglil changed the title CONFTEST_TRACE env var / --trace flag is not respected when --output=table Trace is not outputted when --output=table Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants