aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-12-12referential_lock_during_creation_spec: Don't create unnecessary RefTeddy Wing
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
2017-12-12Referential: Lock table on :updateTeddy Wing
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
2017-12-12Referential: Raise an error if the table lock times outTeddy Wing
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
2017-12-12Try to push a new file for locales to fix perhaps encoding problem Refs #4738Luc Donnet
2017-12-11rails_helper.rb: Remove `use_transactional_fixtures = true`Teddy Wing
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
2017-12-11Referential#create_schema: Log benchmark time to createTeddy Wing
We want some measurements for how long it takes to create schemas to give us some data to decide whether to put `#create_schema` in an `after_commit` somehow (it didn't work the simple way). This at least gives us a better idea of what's going on and how our table lock is performing. Refs #5024
2017-12-11Revert "Referential: Move `create_schema` to an `after_commit`"Teddy Wing
This reverts commit 5ae238936d3c91e70709c2ec4ed8a73a6f4524dc. I was getting a bunch of test errors like this: 1) Referentials destroy should remove referential Failure/Error: Apartment::Tenant.switch!(slug) Apartment::TenantNotFound: One of the following schema(s) is invalid: "test_1" "first", "shared_extensions" # .../.gem/ruby/2.3.3/gems/apartment-1.0.2/lib/apartment/adapters/postgresql_adapter.rb:92:in `rescue in connect_to_new' # .../.gem/ruby/2.3.3/gems/apartment-1.0.2/lib/apartment/adapters/postgresql_adapter.rb:85:in `connect_to_new' # .../.gem/ruby/2.3.3/gems/apartment-1.0.2/lib/apartment/adapters/abstract_adapter.rb:84:in `switch!' # ./app/models/referential.rb:139:in `switch' # ./app/controllers/referentials_controller.rb:26:in `show' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:198:in `process_action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:20:in `block in process_action' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/abstract_controller/callbacks.rb:19:in `process_action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal/instrumentation.rb:30:in `process_action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' # .../.gem/ruby/2.3.3/gems/activerecord-4.2.8/lib/active_record/railties/controller_runtime.rb:18:in `process_action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/abstract_controller/base.rb:137:in `process' # .../.gem/ruby/2.3.3/gems/actionview-4.2.8/lib/action_view/rendering.rb:30:in `process' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal.rb:196:in `dispatch' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_controller/metal.rb:237:in `block in action' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:74:in `dispatch' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:43:in `serve' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb:43:in `block in serve' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb:30:in `each' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/journey/router.rb:30:in `serve' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/routing/route_set.rb:817:in `call' # .../.gem/ruby/2.3.3/gems/devise_cas_authenticatable-1.10.0/lib/devise_cas_authenticatable/single_sign_out/rack.rb:14:in `call' # .../.gem/ruby/2.3.3/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call' # .../.gem/ruby/2.3.3/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch' # .../.gem/ruby/2.3.3/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/etag.rb:24:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/conditionalget.rb:25:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/head.rb:13:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/params_parser.rb:27:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/flash.rb:260:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:225:in `context' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/session/abstract/id.rb:220:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/cookies.rb:560:in `call' # .../.gem/ruby/2.3.3/gems/activerecord-4.2.8/lib/active_record/query_cache.rb:36:in `call' # .../.gem/ruby/2.3.3/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:88:in `__run_callbacks__' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_call_callbacks' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/remote_ip.rb:78:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' # .../.gem/ruby/2.3.3/gems/railties-4.2.8/lib/rails/rack/logger.rb:38:in `call_app' # .../.gem/ruby/2.3.3/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `block in call' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `block in tagged' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:26:in `tagged' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `tagged' # .../.gem/ruby/2.3.3/gems/railties-4.2.8/lib/rails/rack/logger.rb:20:in `call' # .../.gem/ruby/2.3.3/gems/request_store-1.3.2/lib/request_store/middleware.rb:9:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/request_id.rb:21:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/methodoverride.rb:22:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/runtime.rb:18:in `call' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/lock.rb:17:in `call' # .../.gem/ruby/2.3.3/gems/actionpack-4.2.8/lib/action_dispatch/middleware/static.rb:120:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/sendfile.rb:113:in `call' # .../.gem/ruby/2.3.3/gems/railties-4.2.8/lib/rails/engine.rb:518:in `call' # .../.gem/ruby/2.3.3/gems/railties-4.2.8/lib/rails/application.rb:165:in `call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/urlmap.rb:66:in `block in call' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/urlmap.rb:50:in `each' # .../.gem/ruby/2.3.3/gems/rack-1.6.8/lib/rack/urlmap.rb:50:in `call' # .../.gem/ruby/2.3.3/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request' # .../.gem/ruby/2.3.3/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request' # .../.gem/ruby/2.3.3/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get' # .../.gem/ruby/2.3.3/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:60:in `process' # .../.gem/ruby/2.3.3/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:35:in `process_and_follow_redirects' # .../.gem/ruby/2.3.3/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:21:in `visit' # .../.gem/ruby/2.3.3/gems/capybara-2.4.4/lib/capybara/rack_test/driver.rb:42:in `visit' # .../.gem/ruby/2.3.3/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit' # .../.gem/ruby/2.3.3/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>' # ./spec/features/referentials_spec.rb:193:in `block (3 levels) in <top (required)>' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `block in load' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency' # .../.gem/ruby/2.3.3/gems/activesupport-4.2.8/lib/active_support/dependencies.rb:268:in `load' # .../.gem/ruby/2.3.3/gems/spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call' # -e:1:in `<main>' # ------------------ # --- Caused by: --- # ActiveRecord::StatementInvalid: # Could not find schema test_1 # .../.gem/ruby/2.3.3/gems/apartment-1.0.2/lib/apartment/adapters/postgresql_adapter.rb:86:in `connect_to_new' Couldn't figure out how to get around this. The problem is that: 1. The referential is created 2. The app tries to switch to the newly-created referential's schema 3. The schema is created But of course we can't switch to a schema that doesn't exist. After a discussion with Luc & Alban, we decided to leave out the `after_commit`. I'll be logging a benchmark of time it takes for schema creation to give us an idea of the time & performance impact of the schema creation and lock.
2017-12-11Merge pull request #140 from af83/5197-compliance-control-set-view-specLuc Donnet
5197 compliance control set view spec
2017-12-11Refs: #5197@2h; Rebasing and removing empty helper spec5197-compliance-control-set-view-specRobert
Bad conflict resolution during rebase fixed (app/helpers/compliance_control_sets_helper.rb)
2017-12-11Refs: #5197@0.5h; Rebased on master; Empty spec removedRobert
2017-12-11Refs: #5197@0.25h; Minor ApprovementsRobert
2017-12-11Fixes: #5197@0.15h; Red Green Cycle to test the specs and the implementationRobert
- Removed functionality --> Red - Refactored and added functionality --> Green
2017-12-11Refs: #5197@0.5h; Passing specs addedRobert
2017-12-11Fix action links button text Refs #5203Luc Donnet
2017-12-11Merge branch 'master' of github.com:af83/stif-boivRobert
2017-12-11Hotfix (Refs: #5209) Skip randomly failing specRobert
2017-12-11Merge pull request #144 from af83/4812-display_empty_compliance_control_blocksLuc Donnet
Refs 4812 UX changes to show empty compliance control blocks so the u…
2017-12-08Refs #5203 Fix typocedricnjanga
2017-12-08Refs #5162 refacto import resource view + add missing logos on other viewscedricnjanga
2017-12-08Merge pull request #142 from af83/5198-workbench-view-spec-modal-action-boxteddywing
Refs: #5198@1.5h; Specing the presence of the Modal Action Box
2017-12-08Refs 4812 UX changes to show empty compliance control blocks so the user can ↵4812-display_empty_compliance_control_blockscedricnjanga
see them all
2017-12-08Merge branch 'master' into stagingLuc Donnet
2017-12-07Add libmagic dependency due to reflex gem updateLuc Donnet
2017-12-07Fix worbench_import status update when a netex_import has a warning status ↵Luc Donnet
and others successful Refs #5202
2017-12-07Refs: #5198@1.5h; Specing the presence of the Modal Action BoxRobert
- 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
2017-12-07Merge branch 'master' into stagingLuc Donnet
2017-12-06Merge branch 'master' into stagingLuc Donnet
2017-12-06Merge remote-tracking branch 'origin/master' into ↵Teddy Wing
5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659
2017-12-06Refs #5196 Fix display of Add buttons (CC & CCB)cedricnjanga
2017-12-06Referential: Move `create_schema` to an `after_commit`Teddy Wing
The goal being to separate the creation of the database schema from the creation of the `Referential` object. Previously these were created in the same database transaction, but moving the schema to an `after_commit` puts it in a separate transaction. This change tries to mitigate a problem where two `Referential`s, created at the same time with the same data, can be saved, even though identical `Referential`s should not be allowed. By moving the schema creation to a separate transaction, we decrease the time it takes to create a `Referential`, increasing the odds of not creating two identical `Referential`s due to near-simultaneous writes. Refs #5024 Conflicts: app/models/referential.rb
2017-12-06referential_lock spec: Don't create unnecessary referentialTeddy Wing
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
2017-12-06Fix log to detect schema migrations overwriteLuc Donnet
2017-12-06Add log to detect schema migrations overwriteLuc Donnet
2017-12-06spec_helper.rb: Enable `truncation` test; Disable `wip` testsTeddy Wing
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
2017-12-06- Change inheritance naming in api/v1 controllers => it generated errorscedricnjanga
- add format: :json in controller specs
2017-12-05Add some changes according to PR reviewcedricnjanga
2017-12-05Merge remote-tracking branch 'origin/master' into ↵Teddy Wing
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.
2017-12-05Merge pull request #132 from af83/5127_new_api_endpointsLuc Donnet
Refs #5127 Add two new endpoints to the API
2017-12-05- Comment parent.child_change call in ComplianceCheckSet#notify_parent to ↵cedricnjanga
avoid errors - Clean new routes (we dont need aliases)
2017-12-05Merge pull request #139 from af83/5179-ref_creation_enforces_objectid_formatLuc Donnet
5179 ref creation enforces objectid format
2017-12-05Fixes: #5179@1h; Referential Creation Enforces objectid_format from ↵5179-ref_creation_enforces_objectid_formatRobert
associated Workbench - CR changes implemented
2017-12-05Merge branch '5127_new_api_endpoints' of github.com:af83/stif-boiv into ↵cedricnjanga
5127_new_api_endpoints
2017-12-05Small refacto to handle no_parent error for ComplianceCheckSetcedricnjanga
2017-12-05Refs #5127 Add two new endpoints to the APIcedricnjanga
ComplianceCheckSet#notify_parent NetexImport#notify_parent
2017-12-05Refs: #5179@0.25h; Referential Creation Enforces objectid_format from ↵Robert
associated Workbench - Removed obsolete spec
2017-12-05Refs: #5179@1.25h; Referential Creation Enforces objectid_format from ↵Robert
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`?
2017-12-05Refs: #5179@1h; Referential Creation Enforces objectid_format from ↵Robert
associated Workbench [skip-ci] - speced the `define_default_attributes` part - speced the Reference.new_from part
2017-12-05referential_lock_during_creation_spec: Remove extra whitespaceTeddy Wing
Refs #5024
2017-12-05Refs #5170 Change default order of ComplianceCheckSet => created_at: :desccedricnjanga
2017-12-05Refs #5169 Change default import sortingcedricnjanga