Skip to content

Add getopt in e2e script for enhanced command line arg handling. #3433

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

Merged
merged 5 commits into from
Jun 27, 2025

Conversation

meet2mky
Copy link
Collaborator

@meet2mky meet2mky commented Jun 20, 2025

Description

Adding getopt option in e2e test run script which offers enhanced arg handling and clean way of executing script.
Ref: https://www.man7.org/linux/man-pages/man3/getopt.3.html
Fixed optional resource usage collection in e2e script as per the comment in : #3414 (comment)

Example ways to run the script~

$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location us-central1

$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location us-central1 --presubmit

$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location us-central1 --presubmit --zonal

Example ways to not run the script~

$ ./tools/integration_tests/improved_run_e2e_tests.sh 
[INFO] 2025-06-25 11:12:10: Bash version: 5.2
[ERROR] 2025-06-25 11:12:10: Invalid or empty value [] for option --bucket-location.
Usage: ./tools/integration_tests/improved_run_e2e_tests.sh [options]
Options:
  Required:
    --bucket-location             <location>     The Google Cloud Storage bucket location (e.g., 'us-central1').

  Optional:
    --test-installed-package                     Test installed gcsfuse package. (Default: false)
    --skip-non-essential-tests                   Skip non-essential tests inside packages. (Default: false)
    --tpc-endpoint                               Run tests on TPC endpoint. (Default: false)
    --presubmit                                  Run tests with presubmit flag. (Default: false)
    --zonal                                      Run tests with zonal bucket. (Default: false)
    --no-build-binary-in-script                  To disable building gcsfuse binary in script. (Default: false)
    --package-level-parallelism   <parallelism>  To adjust the number of packages to execute in parallel. (Default: 10)
    --track-resource-usage                       To track resource(cpu/mem/disk) usage during e2e run. (Default: false)
    --help                                       Display this help and exit.


$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location
[INFO] 2025-06-25 11:12:38: Bash version: 5.2
./tools/integration_tests/improved_run_e2e_tests.sh: option '--bucket-location' requires an argument

$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location ""
[INFO] 2025-06-25 11:13:19: Bash version: 5.2
[ERROR] 2025-06-25 11:13:19: Invalid or empty value [] for option --bucket-location.

$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location --another-param
[INFO] 2025-06-25 11:13:50: Bash version: 5.2
[ERROR] 2025-06-25 11:13:50: Invalid or empty value [--another-param] for option --bucket-location.

$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location us-central1 --non-existent-flag
[INFO] 2025-06-25 11:14:27: Bash version: 5.2
./tools/integration_tests/improved_run_e2e_tests.sh: unrecognized option '--non-existent-flag'

$ ./tools/integration_tests/improved_run_e2e_tests.sh --bucket-location us-central1 --presubmit=some-value
[INFO] 2025-06-25 11:15:00: Bash version: 5.2
./tools/integration_tests/improved_run_e2e_tests.sh: option '--presubmit' doesn't allow an argument

Link to the issue in case of a bug fix.

b/426462003

Testing details

  1. Manual - Yes
  2. Unit tests - NA
  3. Integration tests - Yes

Any backward incompatible change? If so, please explain.

No

@meet2mky meet2mky requested review from Tulsishah and a team as code owners June 20, 2025 15:41
@meet2mky meet2mky added the execute-integration-tests Run only integration tests label Jun 20, 2025
@meet2mky meet2mky requested a review from ashmeenkaur June 20, 2025 15:41
@meet2mky meet2mky added the execute-integration-tests-on-zb To run E2E tests on zonal bucket. label Jun 20, 2025
@kislaykishore kislaykishore requested a review from a team June 20, 2025 15:41
@meet2mky meet2mky self-assigned this Jun 20, 2025
@meet2mky meet2mky force-pushed the add-getopt-in-e2e-script branch from ef9f117 to 993444f Compare June 20, 2025 15:48
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.04%. Comparing base (b190907) to head (791043b).
Report is 17 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3433      +/-   ##
==========================================
+ Coverage   78.82%   79.04%   +0.22%     
==========================================
  Files         139      140       +1     
  Lines       18440    18520      +80     
==========================================
+ Hits        14535    14640     +105     
+ Misses       3421     3395      -26     
- Partials      484      485       +1     
Flag Coverage Δ
unittests 79.04% <ø> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@meet2mky meet2mky requested review from codechanges and removed request for a team and ashmeenkaur June 23, 2025 02:43
codechanges
codechanges previously approved these changes Jun 24, 2025
@meet2mky meet2mky requested a review from anushka567 June 24, 2025 05:23
@meet2mky meet2mky added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Jun 24, 2025
Copy link

Hi @Tulsishah, @anushka567, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@meet2mky meet2mky requested a review from raj-prince June 26, 2025 02:23
@meet2mky
Copy link
Collaborator Author

@gemini-code-assist /gemini review

@meet2mky meet2mky requested review from gargnitingoogle and removed request for anushka567 and raj-prince June 26, 2025 08:41
Copy link
Collaborator

@gargnitingoogle gargnitingoogle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I couldn't finish reviewing it earlier in the day. Couple more comments.

Copy link
Collaborator

@raj-prince raj-prince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relying on Nitin's review!

@meet2mky meet2mky merged commit 45d1306 into master Jun 27, 2025
13 checks passed
@meet2mky meet2mky deleted the add-getopt-in-e2e-script branch June 27, 2025 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants