Skip to content
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

Fixed replica_spec.rb and replica.rb #5649

Merged
merged 2 commits into from
Feb 14, 2024

Conversation

omChauhanDev
Copy link
Contributor

@omChauhanDev omChauhanDev commented Feb 13, 2024

What this PR does

Fixes #5647
This pr resolve the issue in the test case 'returns a list of existing articles' spec in spec/lib/replica_spec.rb. The original test was performing multiple tasks and was unreliable. To rectify this, I modularized the test into smaller tests, each focusing on individual articles.

Screenshots

Before:

image

After:

image

@omChauhanDev
Copy link
Contributor Author

All the tests which are failing in CI build are passing locally.

image

lib/replica.rb Outdated
@@ -144,7 144,8 @@ def api_post(endpoint, key, data)
return if response.body.empty?
parsed = Oj.load(response.body)
raise unless parsed['success']
parsed['data']
filtered_data = parsed['data'].select { |article| data.include?(article['page_title']) }
return filtered_data
Copy link
Member

Choose a reason for hiding this comment

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

Why is this change to replica.rb included?

Copy link
Contributor Author

@omChauhanDev omChauhanDev Feb 14, 2024

Choose a reason for hiding this comment

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

Sorry, this change was not required.
Initially, due to the fact that i was seeing previous vcr response again and again, i thought that the api is not filtering out data with the provided tittle.
Now when i changed the vcr cassette name for recording response, got to know api is working fine as expected.

@omChauhanDev
Copy link
Contributor Author

omChauhanDev commented Feb 14, 2024

Found that now article "Autism" does not exist in namespace 118 --> Only reason leading to the failure of previous test case.
Now this is working fine.

@omChauhanDev
Copy link
Contributor Author

Failing tests are flaky.

@ragesoss
Copy link
Member

Looks good to me

@ragesoss ragesoss merged commit a4850c4 into WikiEducationFoundation:master Feb 14, 2024
1 check failed
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.

Refactor and fix replica_spec 'API Requests > returns a list of existing articles'
2 participants