-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Tests for query command outputs #37343
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
base: main
Are you sure you want to change the base?
Conversation
e7fd3fb
to
afb2730
Compare
875323e
to
d2b4619
Compare
Return warning to the CLI if the config has no query files.
d2b4619
to
7822e33
Compare
t.Fatalf("bad: %d\n\n%s", code, output.Stderr()) | ||
|
||
// Check that we have query output | ||
if !strings.Contains(actual, ts.expectedOut) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expected this test to fail after merging the updates to the line-based output. However, it appears that this line is never executed. I think the if statements are mixed up here.
output = done(t) | ||
actual := output.All() | ||
if len(ts.expectedErr) == 0 { | ||
if code != 0 && len(ts.expectedErr) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if code != 0 && len(ts.expectedErr) == 0 { | |
if code != 0 { |
We already checked this in the line above
diags = diags.Append(tfdiags.Sourceless( | ||
tfdiags.Error, | ||
"No configuration files", | ||
"Query Plan requires a query configuration to be present. Create a Terraform query configuration file (.tfquery.hcl file) and try again.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Query Plan requires a query configuration to be present. Create a Terraform query configuration file (.tfquery.hcl file) and try again.", | |
"Query requires a query configuration to be present. Create a Terraform query configuration file (.tfquery.hcl file) and try again.", |
This PR introduces some tests for query command outputs. Also, a warning is returned when the config does not have any list resources.
Target Release
1.14.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry