-
Notifications
You must be signed in to change notification settings - Fork 499
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
Fix #2780: Call checkIfLoadingIsPossible() after inject() in LessonThumbnailImageView #3043
Conversation
@anandwana001 PTAL. |
The lint test has failed because of the semi-colon that I used in the empty while loop. That was necessary to mark that loop as empty. |
I guess |
@anandwana001 Sorry, I don't understand what you mean by installation process. |
To setup pre-push hooks to prevent the ktlint check errors Ref: 4th point in https://github.com/oppia/oppia-android/wiki#installation |
Deferring to Rajat for inital pass, as he is the codeowner. |
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.
@ArpitShukIa Adding an infinite loop doesn't seem like a correct approach to me at the same time I understand this issue is not that easy too.
@BenHenning Do you have any comments on this approach?
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.
Hi @ArpitShukIa. Left one comment--PTAL when you can.
app/src/main/java/org/oppia/android/app/customview/LessonThumbnailImageView.kt
Outdated
Show resolved
Hide resolved
@ArpitShukIa I believe you have a few errors to correct in CI:
I suggest making sure the new test builds & passes locally before sending this back to reviewers. This is probably just an issue from syncing to the latest develop changes (I suggest looking at other tests to see how they fill in these bindings). Also, can you confirm whether the new test is passing on Espresso? That + the green CI are my main blockers before approving the PR since it otherwise LGTM. |
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.
LGTM, as per my earlier comment.
All the checks have passed but the Expresso problem is still there. The tests keep on running indefinitely. Expresso.tests.mov |
@ArpitShukIa we might need to make this a Robolectric-only test. I'm not entirely sure why it doesn't work on Espresso, but given that the original regression triggers a test failure in Robolectric I think it being Robolectric-only is fine. Can you move it to be in the same directory structure except |
Though thinking on this more, it either indicates a real issue that Robolectric isn't covering, or it's not liking how we're creating the view. @ArpitShukIa you should also step-debug the Espresso test if you can to try and narrow down where the test is starting to hang. I think those findings should be identified before we move the test (though that's a valid option if we can't solve the Espresso issue). |
@BenHenning The expresso tests are passing now :) |
Ah, that's really subtle @ArpitShukIa. Nice find. Could you actually file an issue to the thread of: we should introduce a static analysis check or somehow trigger test failures in these situations to avoid the test hanging? It might require us to wrap Espresso's API, but I think that'd be worth it to avoid people running into this in the future. This seems tricky to debug/track down. |
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.
Given that the tests are now passing for both Robolectric & Espresso, this LGTM. Thanks @ArpitShukIa!
@rt4914 sending this over to you since I think only your review is needed now. |
@BenHenning I am a little confused about the description of the issue. Could you instead file the issue plz? The problem was that |
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.
LGTM, thanks.
@ArpitShukIa we should have a test or check to ensure that such cases fail immediately with a good error message for developers to fix the situation rather than running into the deadlock (the deadlock is exactly what we want to avoid since it's difficult to understand what's going wrong). Static analysis or specific failure tests are a good way to prevent these sorts of situations from happening. Edit: I went ahead and filed #3150 to make sure this context is captured. |
Explanation
Fixes #2780: The problem was that few dependencies weren't available at the time of calling
checkIfLoadingIsPossible()
soloadLessonThumbnail()
was not getting called for that particular image. I simply added a call tocheckIfLoadingIsPossible()
after Dagger inject() call and that fixed the issue.Test Results:
Before:
Robolectric:
Expresso:
After:
Robolectric:
Expresso:
UI Results:
Before:
Before.mp4
After:
After.mp4
Checklist