Skip to content

testing(internal/kokoro): improve escaping for no-change bailout #12482

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shollyman
Copy link
Contributor

This PR changes the bash operator slightly for the case where we attempt to exit testing earlier if there are no significant changes.

I noticed when testing an unrelated change that the error log for this file complains about this line because -z is a unary operator. This change quotes the variable so that the it doesn't get split by the bash test.

Sample output where things went wrong:

+ SIGNIFICANT_CHANGES='bigquery/v2
bigquery/v2/apiv2_smoketests'
+ '[' -z bigquery/v2 bigquery/v2/apiv2_smoketests ']'
github/google-cloud-go/internal/kokoro/presubmit.sh: line 84: [: bigquery/v2: binary operator expected
++ echo 'bigquery/v2
bigquery/v2/apiv2_smoketests'
++ tr ' ' '\n'
++ cut -d/ -f1
++ tr '\n' ' '
++ sort -u
++ xargs ls -d
+ CHANGED_DIRS=bigquery

This PR changes the bash operator slightly for the case where we
attempt to exit testing earlier if there are no significant changes.

I noticed when testing an unrelated change that the error log for this
file complains about this line because -z is a unary operator.  This
change quotes the variable so that the it doesn't get split by the bash
test.

Sample output where things went wrong:
```
+ SIGNIFICANT_CHANGES='bigquery/v2
bigquery/v2/apiv2_smoketests'
+ '[' -z bigquery/v2 bigquery/v2/apiv2_smoketests ']'
github/google-cloud-go/internal/kokoro/presubmit.sh: line 84: [: bigquery/v2: binary operator expected
++ echo 'bigquery/v2
bigquery/v2/apiv2_smoketests'
++ tr ' ' '\n'
++ cut -d/ -f1
++ tr '\n' ' '
++ sort -u
++ xargs ls -d
+ CHANGED_DIRS=bigquery
```
@shollyman shollyman requested review from quartzmo and codyoss June 23, 2025 20:38
@shollyman shollyman requested a review from a team as a code owner June 23, 2025 20:38
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

Successfully merging this pull request may close these issues.

1 participant