| Age | Commit message (Collapse) | Author |
|
|
|
|
|
After re-reading the ticket, I see now that the aborting of old imports
should only apply to `NetexImport`s. Update the code to make this
happen.
Refs #4963
|
|
Imports that have a `finished_status` should not be changed to
`aborted`.
Refs #4963
|
|
This will abort all imports that don't have a finished status and were
created more than four hours ago.
We want to add this functionality to the import cron to auto-abort stale
imports.
Refs #4963
|
|
|
|
and others successful Refs #5202
|
|
|
|
|
|
|
|
When an import is destroyed, all:
* child imports
* associated `ImportReference`s
* associated `ImportMessage`s
must be destroyed. This is handled by a `dependent: :destory` on the
associations.
Here we add tests to validate that the records get properly destroyed.
Refs #4412
|
|
#4257 #4258
|
|
|
|
|
|
|
|
When any one of a parent import's children have failed, the parent
import should get status 'failed'.
|
|
Getting rid of the other commented test that checks failure because that
combination is no longer relevant and the basic failure cases are
handled by the specs just above.
|
|
Since we're not verifying `ended_at`, we have no need for the `Timecop`
block.
|
|
The name doesn't really match what's happening, since no `child` is
passed in as an argument any more. This just always happens any time
there are one or more failing children.
Remove the mock expectation because the extra fields don't really relate
to what we're supposed to be testing here, namely `status`.
|
|
These tests fail and are now wrong. While we previously prevented
updating the import object in the old code, now the `#update` method
gets called no matter what.
|
|
The new `#child_change` doesn't do a whole lot, so the specs that used
to test it don't belong any more. Update them so they test
`#update_status` instead, where this logic now lives.
|
|
This method name was changed in 46aafcc4dbc65ef3216fbcae3b11b263e1c025c0
because it handles multiple referentials now. Update the tests to
reflect that.
|
|
Update the mock to include the `ended_at` field update that happens in
the code to get these tests green again. Not sure if we're going to
continue to use them in their current state, but we'll worry about that
later.
|
|
|
|
Need to get this ready for QA and I have to leave for a client meeting
RIGHT NOW. As concluded in discussions, SKIP ALL THE THINGS so we can
get the code into the hands of testers.
|
|
Previously we were only updating the `ended_at` field when the import
had a 'successful' status. But there are other statuses that indicate
the import finished, and the `ended_at` field should be updated in these
cases also.
Committing what I have now which seems to work but I didn't write specs
for it because it was a pain to test (what with creating a child, etc.).
The `#update_status` method should be refactored to make testing the
`ended_at` update easier.
This needs to be committed without specs now because I'm off to go to a
client meeting and this work/branch is blocking QA of imports both
internally and externally. So I guess doing things right comes later.
That is to say, probably a lot later. Who knows.
|
|
A bunch of things that need to be written to get this in proper working
order.
|
|
This method is no longer used, now that we have Alban's `#update_status`
method.
Originally this was supposed to be used to determine if the import was
finished or not. Now, the parent import status field update doesn't
depend on it, and we can use the `Referential#ready` field to determine
whether or not to display the import in the interface.
|
|
* The `allow` on the first line didn't appear to be necessary
* Need to use `create` instead of `build_stubbed` in order to provide
access to the `children` relation
* The `#update` method gets called with a hash of arguments now,
containing `current_step` and `status`. Update the mock to match the
new code.
|
|
`Import#child_change` no longer takes an argument, so we need to remove
if from the tests.
|
|
Some quick tests for the recent changes to `#child_change`, to ensure
that `#update_status` and `#update_referential` are called by the
method.
|
|
Refs #4280
|
|
Refs #4270
|
|
I'm still not a fan of these myself, but let's make Robert happy.
Refs #3511
|
|
At Robert's suggestion, convert these methods to RSpec shared examples.
I had thought about using shared examples when I originally wanted to
write these tests, but was trying to get things working quickly and
couldn't figure out how to use them at the time, so I went with
something that seemed obvious to me and worked. Now we can take
advantage of the testing DSL available.
Refs #3509, #3511
|
|
The `#notify_parent` method should update the `notified_parent_at` field
on the child import so we know not to query it in subsequent batches of
parent import notifications.
Add the Timecop gem in order to be able to safely test the DateTime
update.
Refs #3511
|
|
Not sure if this could cause any problems, but it makes more sense to me
to put the helper method in the test where it's used, since that's the
only place where it's used and that test is the only reason why it
exists.
Refs #3509, #3511
|
|
Don't update the parent status if it's already been set to a finished
status. This protects against situations like this:
child_import_1 status: :failed
#child_change => parent_import status: :failed
child_import_2 status: :successful
#child_change => parent_import status: :successful
In that scenario, even though one of the parent's children had failed,
it still gets a successful status at the end. To prevent that situation,
don't update the parent's status if it's already been set to a finished
status.
Refs #3509, #3511
|
|
I had apparently committed these comments from before I had written any
tests and was thinking about what to test. Remove them.
Refs #3509, #3511
|
|
The `#child_change` method should update the current import (the parent)
with a 'failed' or 'successful' status depending on the status of the
child passed in.
If the child has a failure status, the parent import should be updated
to failed. If the import is `#ready?`, that tells us that all children
have called `#child_change` without any problems, and we can update the
parent's status to be successful. THAT PARAGRAPH IS WRONG. We could have
`#ready?` with failed children. NEED TO UPDATE TO SUPPORT THAT.
Add a method that describes the possible "failing" statuses. These are
the ones that will cause 'failed' to be set on the parent.
Refs #3509, #3511
|
|
This boolean method answers whether or not the current import's
`current_step` and `total_steps` fields match. If so, all of its
subtasks are finished, in which case it can be thought of as "ready".
Refs #4174, #3511
|
|
Calling `#notify_parent` should call the `#child_change` method on the
import's parent import. That `#child_change` method will tell the parent
to update itself based on the status of the child.
Refs #3511
|
|
A new service, `ParentImportNotifier`, will be called by a Cron job
every 5 minutes. This service will query all finished sub-imports that
haven't yet notified their parent, and tell them to do so.
factories/workbench_imports.rb:
Add a `WorkbenchImport` factory. This is currently incomplete. We'll
want to correctly initialise the `file` attribute eventually.
import.rb:
factories/imports.rb:
In order to get the test setup to work correctly, we skip the
`before_create` callback on `Import`. This is because that callback
initialises `status` to "new". We want to be able to set any status
value in our tests to test things properly. Thus the callback messes
with our buttermilk. For all imports created by the factory, skip this
callback. In order to skip the callback, I had to put it in its own
method and pass the method name to `#skip_callback`. That's why the
callback is now in a new method in `Import`.
Adds an empty `#notify_parent` method in `Import`. For now this doesn't
do anything, but eventually it will be filled in to perform the actual
notification. I this changeset, all we're doing is setting up the
connecting logic to notify the right things from the Cron job.
import_spec.rb:
Remove the `.class_name` validation because we removed that previously
in `Import`. The `belongs_to` is now a polymorphic association, with no
class name specified.
parent_import_notifier_spec.rb:
Needed to use `create` instead of `build_stubbed` in a lot of these
cases so that I could validate the query. Really don't like this because
now this set of tests is SUPER SLOW. If you have any ideas for how to
speed it up, let's do that.
Refs #3511
|
|
- Added tests for HTTPService (regression)
- Removed some dead code (Workbench model spec, Import factory)
- Changed front_end_host to rails_host in config
|
|
|
|
|
|
Introduction of Presence Validation in Import model, for:
- workbench
- referential
|
|
- Import#parent_id & #parent_type migration generated
- Import#belongs_to :parent, class_name: to_s specified
- Import#belongs_to :parent, class_name: to_s implemented
|
|
|
|
|