| Age | Commit message (Collapse) | Author |
|
Since the tests I was trying to use `truncation` for are now skipped,
remove these exceptions and revert this line back to what it was before
all this mess.
Refs #5024
|
|
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
|
|
After the first `truncation: true` test ran, all tables would be
cleared. This caused errors as our tests rely on a referential like this
existing:
Referential.create(name: 'first')
It also caused problems with `LineReferential` as the `:chouette_line`
factory depends on an existing `LineReferential` associated to the
`first` Referential.
Add the `referentials` and `line_referentials` tables to the exclusion
list when truncating so these tables don't get cleared and the 'first'
records persist across test runs like before.
To prevent errors trying to unnecessarily switch to the 'first'
referential in `truncation: true` tests, disable that functionality by
adding a filter to exclude these tests from the normal transactional
`before(:each)` config block.
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
|
|
We want `DatabaseCleaner` to handle our database cleanup because
sometimes we need to use a database truncation strategy instead of
transactions.
I need it to test the `Referential` table lock.
This line gets removed instead of the config being set to `false` here
because we defer to `spec_helper.rb` which already does that and does
the `DatabaseCleaner` stuff through `spec/support/referential.rb`.
Refs #5024
|
|
|
|
|
|
|
|
|
|
|
|
Refs 4812 UX changes to show empty compliance control blocks so the u…
|
|
Refs: #5198@1.5h; Specing the presence of the Modal Action Box
|
|
see them all
|
|
|
|
and others successful Refs #5202
|
|
- verifying the visibility of the action box
- no dynamic behavior of the action box is verified (yet?) - would need javascript execution
- refactoring suggestions --> https://projects.af83.io/issues/5206
|
|
|
|
5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659
|
|
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
|
|
I didn't notice this when I added the `truncation` filter to my
`referentials` table lock test, but the way the specs are configured, it
wouldn't be run by default with the rest of the tests.
Luc did notice, and suggested we change the filter options. We will now
always run tests with the `truncation: true` filter (removing the
`filter_run_excluding` config makes them enabled), as these include
JavaScript-dependent feature tests that we want to be sure to execute.
Additionally, we exclude tests with the `wip: true` filter, as it
doesn't really make sense to run these "work in progress" tests by
default.
Refs #5024
|
|
- add format: :json in controller specs
|
|
|
|
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
- Removed obsolete spec
|
|
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
|
|
Refs #5024
|
|
Refs #5024
|
|
Refs #5024
|
|
|
|
|
|
|
|
|
|
referential state (archived) Refs #5093
|
|
|
|
|
|
|
|
|
|
When creating `ReferentialMetadata`s, I had written in associations with
the `Referential`s built at the top of the tests. However, since those
referentials weren't saved and had no IDs, these "associations" had no
meaning. They can just be removed, and the association will be taken
care of by the `referential_#.metadatas <<` lines.
Thanks to Robert for pointing this out in pre-review.
Refs #5024
|
|
This `before` hook allows tests to use the "truncation" database cleanup
strategy. It doesn't do anything explicitly JavaScript-related. Rather,
it was named JS because it was intended to be used for feature tests
with JavaScript. However, now that I need to use it for a couple tests
in `spec/models/referential_spec.rb`, the `:js` name doesn't make sense.
Rename the filter to something that says what it does, not how it should
be used.
Refs #5024
|