-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update RpmTest to Junit5 #36
Conversation
@g4s8 PLease assign me |
@0crat status |
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.
@HDouss There are some comments, please take a look
home.toFile().mkdirs(); | ||
final Storage storage = new FileStorage(home); | ||
final Path bin = this.folder.newFile("x.rpm").toPath(); | ||
public void updateAarchRpm(@TempDir final Path folder, @TempDir final Path store) |
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.
@HDouss Typo in Aarch
?
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.
@paulodamaso I don't think so. Please see #32 and #30
StandardCopyOption.REPLACE_EXISTING | ||
); | ||
storage.save(new Key.From(key), new RxFile(bin).flow()).get(); | ||
final Storage storage = RpmTest.save(folder, store, key); |
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.
@HDouss Couldn't you inline all in line 110?
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.
@paulodamaso Didn't get it. Inline what?
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.
@HDouss Something like this:
MatcherAssert.assertThat(
new Threads<>(
threads,
new Repeated<Scalar<Boolean>>(
threads,
() -> {
new Rpm(RpmTest.save(folder, store, key)).update(key).blockingAwait();
return true;
}
)
),
Matchers.iterableWithSize(threads)
);
Also, use IsIterableWithSize
instead Matchers.iterableWithSize
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.
@paulodamaso Inlined rpm, but I can't inline storage as it is used afterwards.
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.
@paulodamaso could not inline rpm either as it will create a new rpm for each thread. That will make the test fail.
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.
@HDouss Good point. Let it be, then
String.format("repodata/%s", file) | ||
).toFile().exists(), | ||
Matchers.equalTo(true) | ||
); | ||
} | ||
} | ||
|
||
private static Storage save(final Path folder, final Path store, final String key) |
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.
@HDouss I 'dont like the idea of sharing this piece of code among all our test cases; a bug in here could get us false results from all our tests.
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.
@paulodamaso This part is asked by the puzzle. Besides, isn't that the benefit of behavior encapsulation/method extraction? If a bug is there, either a fix will fix all the tests, or the tests should be splitted because they don't require the same behavior anymore. Given that they share the same behavior for now, it is good to have that I think.
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.
@HDouss I prefer to have all code for creating the data needed in my test cases inside the test, but it is a particular preference. I consider that sharing a untested code (usually these helper function in tests aren't tested, since they are not production code) is more harmful than repeating very similar code for the creation of each test data. By the way, having to create lots of complex objects so we can run the tests may point to the fact that we have architectural problems in code, too.
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.
@paulidamaso I understand even I don't fully agree. What do we do with the fact that this is what asked by the puzzle/issue?
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.
@HDouss Don't change anything; I can fill a bug if I feel the need of refactoring it
This pull request #36 is assigned to @paulodamaso/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @g4s8/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be a monetary reward for this job |
@HDouss This is what I know about this job in CT2E6TK9B, as in §32:
|
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.
@HDouss Please take a look at the answers. Also, please add some meaningful test to the PR title.
String.format("repodata/%s", file) | ||
).toFile().exists(), | ||
Matchers.equalTo(true) | ||
); | ||
} | ||
} | ||
|
||
private static Storage save(final Path folder, final Path store, final String key) |
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.
@HDouss I prefer to have all code for creating the data needed in my test cases inside the test, but it is a particular preference. I consider that sharing a untested code (usually these helper function in tests aren't tested, since they are not production code) is more harmful than repeating very similar code for the creation of each test data. By the way, having to create lots of complex objects so we can run the tests may point to the fact that we have architectural problems in code, too.
StandardCopyOption.REPLACE_EXISTING | ||
); | ||
storage.save(new Key.From(key), new RxFile(bin).flow()).get(); | ||
final Storage storage = RpmTest.save(folder, store, key); |
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.
@HDouss Something like this:
MatcherAssert.assertThat(
new Threads<>(
threads,
new Repeated<Scalar<Boolean>>(
threads,
() -> {
new Rpm(RpmTest.save(folder, store, key)).update(key).blockingAwait();
return true;
}
)
),
Matchers.iterableWithSize(threads)
);
Also, use IsIterableWithSize
instead Matchers.iterableWithSize
Job #36 is already in scope |
@paulodamaso Fixed. About the last point: the method is just copying a file a store it in the storage. The key/file resource being "dynamic" as it is passed as arg. Besides, this is what have been asked by the issue. |
@HDouss Just need to merge changes form master now |
@paulodamaso Thanks. Done! |
@g4s8 Good to merge |
@HDouss thanks, merged. Please try to use more sensible PR titles next time. |
Job was finished in 18 hours, bonus for fast delivery is possible (see §36) |
Resolving issue #32