-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Create and remove test resources based on proper task #752
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
Conversation
Current coverage is 86.67% (diff: 100%)
|
When I tested this, it was invoking the mock-maker. The build now seems to stall completely, so not sure what is suddenly breaking all the tests. When personally testing (e.g. forcing the file and then run the tests in the IDE), the tests succeed. |
The tests for core are executed - only extTest submodule fails (which AFAIR was problematic also when Travis was switched to containerized build). However, I've never seen it hung in that way. |
Hmm, I get the same failing and hanging behavior when running the following locally:
It stalls at the following, indicating there are core tests failing.
Perhaps remove the As for whether the inline-mock-maker is used, adding the following test to the current public class TemporaryTest {
@Test
public void testInlineEnabled() {
if (System.getenv("MOCK_MAKER").equals("mock-maker-inline")) {
assertThat(
"MOCK_MAKER environment variable set but not applied",
Plugins.getMockMaker(),
CoreMatchers.instanceOf(InlineByteBuddyMockMaker.class)
);
}
}
} |
@raphw I am a bit confused with this PR. On the one hand enabling the inline mockmaker seems to work fine locally and we have not received any reports of actual exceptions when using the mockmaker. However, this CI build shows 2 failures and is endlessly looping. Could you verify that the mockmaker is working as intended or identify if there is any possible solution to fix the issues? |
The failure in the CI build concerns this method. The second line crashes with an NPE when mockmaker is enabled, since ListContainer deep_stubbed = mock(ListContainer.class, withSettings().defaultAnswer(RETURNS_DEEP_STUBS).serializable());
when(deep_stubbed.iterator().next().add("yes")).thenReturn(true); I can reproduce this every time by manually enabling and disabling mockmaker by adding and removing respectively the file |
@nhaarman Ah cool, thanks for the investigation! Could you |
I have found why the build was stalling. When using the mock-maker and trying to mock a
I will change these tests to mock |
Darn, since we are using hash maps internally for the mock maker creation, this creates an infinite loop when attempting to look up the mocking logic. We need to hard-code this type exclusion instead of adding a map. |
I have merged the current |
Hm that's a lot of ignored tests 😭 including for the normal mock maker. Could you do |
d5836ee
to
38ccf98
Compare
@nhaarman I'd rather go for the rebase option. It helps to maintain a clean history. |
@bric3 Yep, though I'm a bit cautious rewriting history on public branches. If there's no objection, I'll do so tomorrow. |
It's rebasing the PR branch on top of a public branch, the only rewrite is on your profile branch. And still the previous commits are not lost (reflog, backup branch) |
Also I'd remove the change on hash map, this should be fixed by the mock maker. |
@TimvdLippe's vision was to make sure CI passes so this PR could be merged. What would be the final stance on this? |
38ccf98
to
197dffe
Compare
It's just wrong to modify a test that is supposed to be working just to allow a PR to be merged. Ideally I'll wait on #818 to be fixed. |
One other thing is to document why those tests are disabled with the inline mockmaker. On this I think the team is the best to explain why |
I am also okay with fixing #818 first, initially I thought there were just 2 tests failing but apparently there are a lot more failing 😭 |
197dffe
to
d8cb4d9
Compare
#818 is now fixed, we should take a look without so much test changes |
d8cb4d9
to
48fbf89
Compare
There are 7 tests that fail now:
|
This task makes me think that as devs on our local post, when we run |
These two fail for the same reason
They don't capture the invocation of the public method on the private inner class
Failure of tests in |
48fbf89
to
0879c26
Compare
I think we can close this PR for now and properly fix this when we can actually fix Java 9 compatibility. That is possible when ASM6 has been officially released |
Not sure if anything has changed, but having a test suite that claims to test the inline-mock-maker but doesn't actually, is even worse than having no tests for it at all. |
I was on mobile while writing my last comment and it did not show me the branch. I was under the impression this was targeting master (and would therefore fail on Java 9). However that is not the case, as I remembered incorrectly. @raphw Can you take another look at this one? |
@raphw Running |
We haven't received any reports lately with regards to the Inline mockmaker and potential issues. I think Travis is working okay now. Therefore, I am closing this PR. |
Currently the test resource for the inline mock maker is removed before the test executes, which results in the fact that the inline tests are never really executed properly.
This PR changes the task dependencies to the
test
task.Unfortunately, a lot of tests fail currently when
mock-maker-inline
is enabled.