-
Notifications
You must be signed in to change notification settings - Fork 90
IAM | Basic Interrogation Tests Add User Inline Policy Test Cases #9314
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
IAM | Basic Interrogation Tests Add User Inline Policy Test Cases #9314
Conversation
WalkthroughAdds documentation enforcing that IAM inline policy Changes
Sequence Diagram(s)(omitted — changes are documentation and tests; no new runtime control flow to diagram) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e6c1239 to
f2c88cf
Compare
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/test/integration_tests/api/iam/test_iam_basic_integration.js (1)
76-80: Consider awaitingfolder_deletein asyncafterhook
mocha.afterisasync, butfs_utils.folder_delete(\${config_root}`)is not awaited. Iffolder_deleteis asynchronous (similar tocreate_fresh_pathandfile_must_exist` above), teardown could complete before the directory is actually removed, and any errors would be unobserved.You can make cleanup more robust with:
mocha.after(async () => { if (is_nc_coretest) { - fs_utils.folder_delete(`${config_root}`); + await fs_utils.folder_delete(`${config_root}`); } });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/design/IamUserInlinePolicy.md(1 hunks)src/test/integration_tests/api/iam/test_iam_basic_integration.js(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/test/**/*.*
⚙️ CodeRabbit configuration file
src/test/**/*.*: Ensure that the PR includes tests for the changes.
Files:
src/test/integration_tests/api/iam/test_iam_basic_integration.js
🧬 Code graph analysis (1)
src/test/integration_tests/api/iam/test_iam_basic_integration.js (3)
src/test/system_tests/test_utils.js (1)
is_nc_coretest(48-48)src/test/utils/coretest/nc_coretest.js (1)
mocha(7-7)src/test/utils/coretest/coretest.js (2)
mocha(7-7)assert(8-8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Noobaa Image
- GitHub Check: run-jest-unit-tests
🔇 Additional comments (2)
docs/design/IamUserInlinePolicy.md (1)
96-102: Statement-as-array clarification looks goodThe added note clearly explains the array requirement for
Statementand contrasts AWS vs NooBaa behavior; this should prevent common policy-shape mistakes. No changes needed.src/test/integration_tests/api/iam/test_iam_basic_integration.js (1)
14-27: IAM command imports align with new coverageThe added IAM v3 command imports (user policy, signing certificates, SSH public keys) are all used later in this file and keep the IAM API coverage consistent. No changes needed here.
1. Add test cases for the user inline policy (will not run in NC) 2. Add clarification in our doc, as it is something that I found during testing - Statement as an array in the policy document. 3. Fix mocha.after to run only in NC deployment. Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
d8e7298 to
636b874
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/test/integration_tests/api/iam/test_iam_basic_integration.js (1)
289-311: Consider extracting shared test logic to reduce duplication.The "list user policies for non existing user" and "list user policies for user - should be empty" tests (lines 289-311) duplicate the same tests in the "other APIs" suite (lines 785-807). While this is intentional since suites run in different environments, you could consider extracting the error-case test logic into a shared helper function to reduce maintenance burden.
This is a minor nit given the skip logic ensures no runtime redundancy in NC coretest.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/design/IamUserInlinePolicy.md(1 hunks)src/test/integration_tests/api/iam/test_iam_basic_integration.js(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/design/IamUserInlinePolicy.md
🧰 Additional context used
📓 Path-based instructions (1)
src/test/**/*.*
⚙️ CodeRabbit configuration file
src/test/**/*.*: Ensure that the PR includes tests for the changes.
Files:
src/test/integration_tests/api/iam/test_iam_basic_integration.js
🧬 Code graph analysis (1)
src/test/integration_tests/api/iam/test_iam_basic_integration.js (2)
src/test/system_tests/test_utils.js (1)
is_nc_coretest(48-48)src/endpoint/iam/iam_utils.js (15)
IamError(109-109)IamError(282-282)IamError(508-508)IamError(537-537)IamError(565-565)IamError(572-572)IamError(600-600)IamError(622-622)IamError(651-651)IamError(686-686)IamError(703-703)IamError(718-718)IamError(725-725)IamError(738-738)IamError(742-742)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: run-jest-unit-tests
- GitHub Check: Build Noobaa Image
- GitHub Check: run-package-lock-validation
🔇 Additional comments (3)
src/test/integration_tests/api/iam/test_iam_basic_integration.js (3)
14-27: LGTM!The new IAM policy command imports are correctly added and consolidated. The imports are organized alongside related IAM commands and all are utilized in the new test suite.
261-266: LGTM!The suite-level skip guard correctly prevents the entire suite (including before/after hooks) from executing in NC coretest environments where user inline policy is not implemented. The test constants are well-defined.
334-349: LGTM!The
get user policytest correctly validates the PolicyDocument structure. The Version assertion now properly usesassert.equalfor value comparison, andassert.deepEqualappropriately validates the Statement object content.
Describe the Problem
Currently, we do not have test cases for user inline policy in our basic IAM interrogation tests, as it is not implemented in NC yet.
Explain the Changes
mocha.afterto run only in NC deployment.Issues:
Testing Instructions:
Automatic test
Containerized
docker run -p 5432:5432 -e POSTGRESQL_ADMIN_PASSWORD=noobaa quay.io/sclorg/postgresql-15-c9sNOOBAA_LOG_LEVEL=all ./node_modules/.bin/mocha src/test/integration_tests/api/iam/test_iam_basic_integration.jsNC:
sudo NC_CORETEST=true ./node_modules/.bin/mocha src/test/integration_tests/api/iam/test_iam_basic_integration.jsSummary by CodeRabbit
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.