| Age | Commit message (Collapse) | Author |
|
|
|
|
|
Just discussed this with Alban. The truncation tests are breaking the
test suite, and I've spent way too long on this already. Take the specs
out of the suite for now until we can come up with a different way to
run these or test this behaviour without breaking everything.
The new task to fix this is #5295.
Refs #5024
|
|
The `truncation: true` strategy wasn't sticking. The config `before`
block only ran once for this test file. Instead of attaching the filter
to the `it` blocks, put it on the `context`. This correctly gets each
test to run in a transaction.
Remove the `truncation: false` filter I had added previously as this
didn't do what I wanted it to: it prevented the `before` block from
running instead of filtering out tests with `truncation: true`.
Refs #5024
|
|
Refactor these tests to abstract the thread & transaction creation &
handling. Thread creation and joining can now live in one place apart
from the tests, and the tests have an interface to set up concurrent
referential saving.
Thanks to Johan for this refactor.
Refs #5024
|
|
The `referential_metadata` factory will create an associated referential
by default. This causes errors in our tests because we haven't cleaned
up the trailing referential.
Refs #5024
|
|
We had been locking the `referentials` table on :create, but we also
want to handle :update. Paired on this with Johan.
When I used:
referential_2.metadatas << metadata_2
the referential was saved. To add the metadata without automatically
saving the referential + metadata, Johan suggested using the nested
attribute method:
referential_2.metadatas_attributes = [metadata_2.attributes]
This allows us to add the metadata and still use the `#save` method to
lock the table.
Also change the callback from `before_validation` to `before_save`
because
before_validation :lock_table, on: [:create, :update]
didn't work. That caused an error in our `expect`, as the `be_valid`
triggered the lock callback. To enable the callback on both :create and
:update, use a `before_save` instead.
Refs #5024
|
|
Paired with Johan on this one. There's an internal timeout on our table
lock. If it's reached, an
`ActiveRecord::StatementInvalid<PG::LockNotAvailable>` error is raised.
Use a custom error instead by "overriding" `#save` with a method that
raises our custom error in that case instead. This will enable us to
provide a custom user-facing error in the event this happens.
Refs #5024
|
|
The factory for `referential_metadata` was creating an unnecessary
`Referential` object since it has an association set up. This was
causing the test to fail because that referential's schema wasn't
getting cleaned in the `ensure` block. Don't create that referential to
avoid the error.
Refs #5024
|
|
5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659
Conflicts:
app/models/referential.rb
A whitespace conflict in a place I don't even remember editing? Okaay.
|
|
associated Workbench
- CR changes implemented
|
|
associated Workbench
- changed ObjectIdFormatterSupport as requested
- respeced all defined cases
- implemented respec
Missing:
What to do in `define_default_attributes` if ref has no workbench and no `objectid_format`?
|
|
associated Workbench [skip-ci]
- speced the `define_default_attributes` part
- speced the Reference.new_from part
|
|
Refs #5024
|
|
* Move these two tests to a new file to isolate them from the normal
Referential model tests
* Move the `workbench` to a `let`
* Remove unnecessary schema deletions in transactional synchronous test
* Add comments describing the lock mechanism and how we test it with
threads & sleeps
|
|
CR 2nd part
- typos
- unnecessary `class: Referential` removed from referentials_factory
- regrouping of referential_suite related model specs
|
|
Step 2: Added validation of reference->workbench->organisation consistency
Made all specs pass
Chased bug #4826
|