-
Notifications
You must be signed in to change notification settings - Fork 216
Fix load_templates --clean to wipe more than one entry per table #2955
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
7d054ab to
edbef94
Compare
|
The failure here doesn't look like anything to do with the PR. |
|
yes, ui test failure is unrelated, should be fixed meanwhile with a PR merged to master, retriggered test here. |
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.
This makes generally sense. But let's have @kalikiana have a look at it, too.
| @@ -241,7 +241,7 @@ if ($options{'clean'}) { | |||
| my $id = $result->{$table}->[$i]->{id}; | |||
| my $table_url_id = $url->clone->path($options{'apibase'} . '/' . decamelize($table) . "/$id"); | |||
| $res = $client->delete($table_url_id)->res; | |||
| last if $res->is_success; | |||
| last unless $res->is_success; | |||
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.
I did not realize I'd flipped this condition. Good catch!
| test_once $args, $expected, 'imported original fixtures'; | ||
| is $schema->resultset('Machines')->count, 1, "only one machine is loaded"; | ||
| my $machine = $schema->resultset('Machines')->first; | ||
| is $machine->name, "32bit", "correct machine is loaded"; |
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.
That looks great. Thank you for coming up with the test.
1400d8a inverted the logic here - instead of exiting the loop on a *failure* we now exit it on *success*. So each time --clean is run it will only wipe one entry per table. This obviously breaks things badly (the clean phase doesn't clean things right at all, so the subsequent load phase fails because we try to add entries that already exist, and you wind up with a mess). This flips the logic back, and adds a test. Signed-off-by: Adam Williamson <awilliam@redhat.com>
edbef94 to
5396d7f
Compare
|
I updated your branch. That should fix the failed test. |
Codecov Report
@@ Coverage Diff @@
## master #2955 +/- ##
==========================================
+ Coverage 93.44% 93.46% +0.01%
==========================================
Files 190 190
Lines 11959 11959
==========================================
+ Hits 11175 11177 +2
+ Misses 784 782 -2
Continue to review full report at Codecov.
|
1400d8a inverted the logic here - instead of exiting the loop
on a failure we now exit it on success. So each time --clean
is run it will only wipe one entry per table. This obviously
breaks things badly (the clean phase doesn't clean things right
at all, so the subsequent load phase fails because we try to add
entries that already exist, and you wind up with a mess).
This flips the logic back, and adds a test.
Signed-off-by: Adam Williamson awilliam@redhat.com