-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Sample Data Loading and Test in GitHub Action #3223
Sample Data Loading and Test in GitHub Action #3223
Conversation
WalkthroughThis pull request updates the CI workflow by commenting out the Changes
Sequence Diagram(s)sequenceDiagram
participant Main as addSampleData.main
participant DB as pingDB
participant Admin as ensureAdministratorExists
participant Insert as insertCollections
participant Disconnect as disconnect
Main->>DB: Call pingDB()
alt Successful connection
Main->>Admin: Call ensureAdministratorExists()
Main->>Insert: Execute insertCollections()
else Connection fails
Main-->>Main: Handle connection error
end
Main->>Disconnect: Call disconnect()
sequenceDiagram
participant Main as resetDB.main
participant DB as pingDB
participant Format as formatDatabase
participant Admin as ensureAdministratorExists
participant Disconnect as disconnect
Main->>DB: Call pingDB()
alt Successful connection
Main->>Format: Execute formatDatabase()
alt Formatting successful
Main->>Admin: Call ensureAdministratorExists()
else Formatting fails
Main-->>Main: Log error and warn about admin access
end
else Connection fails
Main-->>Main: Handle connection error
end
Main->>Disconnect: Call disconnect()
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #3223 +/- ##
====================================================
+ Coverage 47.59% 48.46% +0.87%
====================================================
Files 455 457 +2
Lines 33940 34150 +210
Branches 866 933 +67
====================================================
+ Hits 16153 16552 +399
+ Misses 17787 17598 -189 ☔ View full report in Codecov by Sentry. |
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
7 similar comments
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
d488331
to
44d3e1a
Compare
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
…alawa-api into PR-Workflow-(DB)
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
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: 7
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/pull-request.yml
(1 hunks)envFiles/.env.ci
(1 hunks)package.json
(1 hunks)src/utilities/loadSampleData.ts
(2 hunks)src/utilities/testDbConnection.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Run tests for talawa api
- GitHub Check: Analyse Code With CodeQL (typescript)
🔇 Additional comments (7)
src/utilities/testDbConnection.ts (2)
11-23
: Confirm proper error handling for DB connection.Here, the code configures the PostgreSQL client but doesn’t appear to handle or log immediate connection errors. Although drizzle-orm will throw an error if the connection fails at query time, proactively testing the connection upfront or catching errors upon creation can aid in debugging.
Do you want to confirm the connection immediately upon client creation (e.g., by running a simple query and handling errors) to ensure failures are caught early?
133-133
: Invocation of the validation sequence.Calling
runValidation()
at the end is appropriate for a standalone script.src/utilities/loadSampleData.ts (3)
4-10
: Good practice using Argon2 and UUIDv7.Importing
@node-rs/argon2
for password hashing is secure by default (it automatically handles salting), anduuidv7
ensures unique IDs. This is a solid choice for password security and unique user identifiers.
101-150
: Verify uniqueness constraints for administrator account.
ensureAdministratorExists
checks for an admin user by email and creates one if not found. Consider confirming that theemailAddress
field is uniquely constrained in your schema. Otherwise, concurrent runs (or a race condition) might create duplicates. It would also be beneficial to validate that
157-158
: Ensuring admin is created before inserting data.Calling
ensureAdministratorExists
upfront ensures database operations can rely on a pre-existing admin. Excellent approach.envFiles/.env.ci (1)
42-42
: SwitchingNODE_ENV
to test is appropriate.Changing the environment from
production
totest
aligns with the new test-based workflows and scripts. This is correct for isolating test scenarios from production.package.json (1)
91-91
: New DB Connection Script Integration Check
The addition of the"test:db-connection": "tsx ./src/utilities/testDbConnection.ts"
script is clear and aligns well with the new CI job's requirements. It provides a dedicated command for invoking database connection tests in the test environment.
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
0e5298c
to
063d91a
Compare
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
Sir pnpm and node are installed in just runtime shells which don't provide them in non-interactive environments. or other shells, I am fixing it to ensure we have access in all shells and non-interactive environment. |
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
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
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
docker/api.Containerfile
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Run tests for talawa api
- GitHub Check: Analyse Code With CodeQL (typescript)
🔇 Additional comments (1)
docker/api.Containerfile (1)
42-42
:❓ Verification inconclusive
Verify PATH modification doesn't break existing functionality.
The PATH modification adds Node.js binaries and corepack shims. While the implementation looks correct, ensure this doesn't affect any existing functionality that relies on the original PATH order.
🏁 Script executed:
#!/bin/bash # Description: Check if the PATH modification affects any existing commands # Build and run the container to verify PATH docker build -f docker/api.Containerfile --target devcontainer . -t test-container docker run --rm test-container bash -c 'echo $PATH && which node && which corepack'Length of output: 364
Action required: Manually verify that the PATH update preserves command resolution.
The added PATH string in
docker/api.Containerfile
(line 42) now prepends Node.js binaries and corepack shims. However, our automated test script didn’t run successfully (errors indicating "docker: command not found"), so we couldn’t confirm that existing command behavior isn’t disrupted. Please build and run the container in an environment with Docker installed to ensure that:
- The amended PATH correctly locates
node
andcorepack
without affecting other commands.- The order of PATH entries maintains any pre-existing assumptions in the container’s runtime.
@palisadoes PR is ready now. Note: Now we can use commands with ease in any shell without having pnpm or node errors, we don't have to avoid cli execution or force interactive shells, it's permanently fixed , we can use any of these
![]() |
Documentation is updated to run code in one line using cli |
Probably Duplicate issue |
Sir also envFiles/.env.deploy does not effect this here, we can freely configure them as we want. |
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: 6
♻️ Duplicate comments (1)
docs/docs/docs/developer-resources/testing.md (1)
12-17
: 🧹 Nitpick (assertive)Clarify Sample Database Login Credentials Usage
The updated text under the “Sample Database Login Credentials” section is clearer; however, consider including a brief note on where these credentials should be applied (for example, specifying that they are intended for testing or development endpoints). This will help avoid any ambiguity for developers.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
docs/docs/docs/developer-resources/testing.md
(2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
docs/docs/docs/developer-resources/testing.md
208-208: Ordered list item prefix
Expected: 1; Actual: 3; Style: 1/1/1
(MD029, ol-prefix)
214-214: Ordered list item prefix
Expected: 1; Actual: 4; Style: 1/1/1
(MD029, ol-prefix)
220-220: Ordered list item prefix
Expected: 1; Actual: 5; Style: 1/1/1
(MD029, ol-prefix)
230-230: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
231-231: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
233-233: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
234-234: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
234-234: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
234-234: Lists should be surrounded by blank lines
null
(MD032, blanks-around-lists)
235-235: Fenced code blocks should be surrounded by blank lines
null
(MD031, blanks-around-fences)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Run tests for talawa api
- GitHub Check: Analyse Code With CodeQL (typescript)
4ff9d91
into
PalisadoesFoundation:develop-postgres
This needs to be reverted. It's causing other PR merges to fail. Please resubmit. |
This reverts commit 4ff9d91.
When the containers start the |
What is causing this to fail? It seems related to this PR |
Closes #3214
Description
This PR adds a GitHub Action workflow to test the importation of dynamic sample data.
Flow of script
add:sample_data
Proper error catching is implemented for best UX.
reset:db
Key Changes
Next Steps
Improve code coverage for scripts.
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Documentation
Tests
Chores