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

For #110: Added meaningful error for broken package in Rpm.batchUpdate #210

Merged
merged 14 commits into from
Jun 17, 2020

Conversation

paulodamaso
Copy link
Contributor

For #110:

  • added test for checking if Rpm.batchUpdate is throwing an exception when it has a broken package.
  • minor typo correction
  • left puzzle for implementing the behavior

@g4s8 Notice that the behavior somewhat conflicts with #190 : if we are expecting for an exception to be thrown, the metadata content won't be changed after all. Also seems that we should add packages through the Rpm interface instead adding them directly to storage, and call batchUpdate internally

@codecov-commenter
Copy link

codecov-commenter commented May 31, 2020

Codecov Report

Merging #210 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #210   +/-   ##
=========================================
  Coverage     86.40%   86.40%           
  Complexity      269      269           
=========================================
  Files            40       40           
  Lines          1258     1258           
  Branches         55       55           
=========================================
  Hits           1087     1087           
  Misses          160      160           
  Partials         11       11           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47dceda...7565b9c. Read the comment docs.

@0crat
Copy link

0crat commented May 31, 2020

This pull request #210 is assigned to @carlosmiranda/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

Copy link
Contributor

@carlosmiranda carlosmiranda left a comment

Choose a reason for hiding this comment

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

@paulodamaso just one comment

Assertions.assertThrows(
IllegalArgumentException.class,
() -> repo.batchUpdate(Key.ROOT).blockingAwait(),
"RPM package \"brokentwo.rpm\" is broken, can't be read"
Copy link
Contributor

Choose a reason for hiding this comment

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

@paulodamaso let's rephrase this a bit:

Reading of RPM package failed, data corrupt or malformed.

@paulodamaso
Copy link
Contributor Author

@carlosmiranda Done, please take a look

carlosmiranda
carlosmiranda previously approved these changes Jun 3, 2020
Copy link
Contributor

@carlosmiranda carlosmiranda left a comment

Choose a reason for hiding this comment

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

@paulodamaso looks good, just need to sync with master. @g4s8 everything good on my end

Copy link
Member

@g4s8 g4s8 left a comment

Choose a reason for hiding this comment

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

@paulodamaso please check my comment

);
repo.batchUpdate(Key.ROOT).blockingAwait();
final byte[] broken = {0x00, 0x01, 0x02 };
storage.save(
Copy link
Member

Choose a reason for hiding this comment

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

@paulodamaso it's async call which returns CompletableFuture, you either need to wait it with .toCompletableFuture().get() or wrap this call with BlockingStorage

@0crat
Copy link

0crat commented Jun 5, 2020

@carlosmiranda/z this job was assigned to you 5days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please.

@paulodamaso
Copy link
Contributor Author

@g4s8 Corrections made, please take a look

@paulodamaso
Copy link
Contributor Author

@g4s8 ping

Copy link
Member

@olenagerasimova olenagerasimova left a comment

Choose a reason for hiding this comment

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

@paulodamaso added several comments, take a look please. Also I do not see any puzzles here...

storage.save(
new Key.From("stored.rpm"),
new Content.From("stored content".getBytes())
).toCompletableFuture().get();
Copy link
Member

Choose a reason for hiding this comment

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

@paulodamaso please use putFilesInStorage to add some real rpms into storage

new Content.From(
broken
)
);
Copy link
Member

Choose a reason for hiding this comment

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

@paulodamaso please call join here, nothing was actually added to storage

broken
)
);
Assertions.assertThrows(
Copy link
Member

Choose a reason for hiding this comment

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

@paulodamaso to check that exception was thrown is not enough: we need to be sure that metadata files were not changed: I'd suggest obtaining information about metadatafiles after the first update and use it here to compare agains metadata after the second update.

@paulodamaso
Copy link
Contributor Author

@olenagerasimova Done, please take a look. Please note that this PR is about checking that the exception was not thrown; we have another issue to assure that we didn't touched the metadata when invalid packages are updated (#190)

@olenagerasimova
Copy link
Member

@paulodamaso thanks for the corrections and comment, I want to discuss one moment though: as you correctly noticed, #190 (closed already) and #110 have some behavior conflicts. In #110 we decided to that failing the update is more correct, which means, that #110 is not finished yet, but I do not see any puzzles in this PR. Please, could you add the puzzle and explain what we should fail the update and do not touch metadata if invalid package was met?

@paulodamaso
Copy link
Contributor Author

@olenagerasimova Done, please take a look

Copy link
Member

@olenagerasimova olenagerasimova left a comment

Choose a reason for hiding this comment

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

@paulodamaso thanks, looks good to me
@g4s8 please approve/merge

@olenagerasimova
Copy link
Member

@paulodamaso please resolve conflict

@olenagerasimova
Copy link
Member

@paulodamaso please resolve conflicts

@paulodamaso
Copy link
Contributor Author

@olenagerasimova Done, please merge

� Conflicts:
�	src/test/java/com/artipie/rpm/RpmTest.java
@olenagerasimova
Copy link
Member

@g4s8 please approve and I'll merge

@olenagerasimova olenagerasimova merged commit c1edca1 into artipie:master Jun 17, 2020
@0crat 0crat added the qa label Jun 17, 2020
@0crat
Copy link

0crat commented Jun 17, 2020

@sereshqua/z please review this job completed by @carlosmiranda/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat
Copy link

0crat commented Jun 17, 2020

Code review was too long (17 days), architects (@g4s8, @olenagerasimova/z) were penalized, see §55

@0crat 0crat removed the scope label Jun 17, 2020
@sereshqua
Copy link

@carlosmiranda please make sure you will find at least 3 issues during next CR, thanks

@sereshqua
Copy link

@0crat quality acceptable

@carlosmiranda
Copy link
Contributor

@sereshqua confirmed, sorry for the delay. I suffered a laptop crash last week.

@sereshqua
Copy link

@carlosmiranda np :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants