aboutsummaryrefslogtreecommitdiffstats
path: root/spec/workers
AgeCommit message (Collapse)Author
2018-05-10Fix specs. Refs #6960Alban Peignier
2018-04-27Use truncation in ReferentialCloningWorker spec to find the created ↵6833-clone-by-commandAlban Peignier
referential outside of the transaction. Refs #6833
2018-01-05Fixes ReferentialCloning specs. Refs #52995299-merge-operationAlban Peignier
2017-12-20Merge pull request #124 from af83/5006-wb_import_filter_refs_with_foreign_linesLuc Donnet
5006 wb import filter refs with foreign lines
2017-12-14Fixes: #5006@10h;Robert
Implementation of Filtering Out Referentials with foreign lines in `app/workers/workbench_import_worker.rb` - Using ZipService with the set of allowed lines of the organisation - Fixing Integration Specs of the worker - Refactoring, Debugging and Rebasing
2017-12-12Move logic to ReferentialCloning. Improve specs. Refs #5283Alban Peignier
2017-11-03Merge pull request #106 from ↵Robert Dober
af83/4782-create-worker-for-compliance-check-copy--rb201710301748 4782 create worker for compliance check copy rb201710301748
2017-10-31Refs: #4817@0.3h; Hotfix for wrong message for spurious directories in zip file4817-better-traductionRobert
2017-10-31Refs: #4817@0.1h; CodeReview related fix filename instead of import nameRobert
2017-10-31Fixes: #4817@0.35; Translations changed, Specs adpated to new translation ↵Robert
param name
2017-10-30ComplianceControlSetCopyWorker spec: Always stub API callTeddy Wing
In the first test, we weren't stubbing the Java API call, so it would get executed for real. Put the HTTP stub in a `before(:each)` call so that it gets stubbed for every test here. Additionally, reorganise the tests a bit to clean them up. Move the HTTP stub to a `let` to allow it to be called in a couple different places. Since the HTTP stub depends on the `check_set` double, move that to a `let` too. And have the `ComplianceControlSetCopier` mock always return `check_set`, now that the app code depends on that return value. Refs #4782
2017-10-30ComplianceControlSetCopyWorker: Pass ComplianceCheckSet ID to JavaTeddy Wing
Previously I had been passing the `ComplianceControlSet` ID to the Java API. The API actually expects the ID of the `ComplianceCheckSet`. In order to get this ID, have the `ComplianceControlSetCopier` return the `ComplianceCheckSet` that it creates, and use that to pass the the ID to the Java API. Refs #4782
2017-10-30ComplianceControlSetCopyWorker: Call Java validation APITeddy Wing
Call the Java API URL to launch a validation after having copied the `ComplianceControlSet` into a `ComplianceCheckSet`. Copied the format with error logging from `NetexImport#launch_java_import`. In the test, make the ID variables global by putting them in `let`s. Add `config.iev_url` to the Rails `test` environment so that we can access this from our tests. TODO: I just realised I'm sending the wrong ID. I should be sending the check set ID. Refs #4782
2017-10-30Add ComplianceControlSetCopyWorkerTeddy Wing
A new worker that launches the work to copy a `ComplianceControlSet` to a `ComplianceCheckSet`. Currently only handles a single control set and referential pair. Probably want to extend this to handle multiple lists of these objects. Also need to add in a call to the Java API to validate the check. Refs #4782
2017-10-24Fixes: #4633;@0.5h; CR changes4633-import-handle-incorrect-zipRobert
2017-10-24Fixes: #4633@0.5h; Implenting correct message for inconsistent zip fileRobert
2017-10-24Refs: #4633@1h; Implenting correct message for corrupt zip fileRobert
2017-10-24Refs: #4633@0.5h; WorkbenchImportWorker implements message creation for ↵Robert
spurious directories - Speced and implemented Missing: - Exact message parameters (change key from xxx, how to add names of spurious directories)
2017-10-24Refs: #4633@3h:Robert
- Discussing Spec - Speced and implemented the corrupt zipfile part Next: - Spec incorrect directory structure part - Implement incorrect directory structure part
2017-10-17Fixes: #4727@0.1h; Added organisation to clone for and rebased master4727-clone-compliance-control-setRobert
2017-10-17Fixes: #4727@0.5h; Worker speced and implementedRobert
2017-10-09Fixes: #4629@0.5h; 2nd Code ReviewRobert
2017-10-09Refs: #4629@1h; Implementing CR + missing worker specRobert
2017-09-07Avoid Appartment schema creation when cloning is pending. Add a spec which ↵Alban Peignier
performs a real referential clone. Refs #4335
2017-09-05WorkbenchImportWorker spec: Check `ended_at` update after importTeddy Wing
The import job now updates its `ended_at` time at the end of the import job. The mock didn't know this, though, so it gave us an error at that call. Add a new expectation for the update of the `ended_at` time to get this test to pass again.
2017-09-05WorkbenchImportWorker spec: Catch `StopIteration` exceptionTeddy Wing
The code was changed in 038710b22ccf3dd2421ec8d07fae45ef05a47ada, but the tests weren't changed to reflect this. In that change, the subdir enumeration is stopped if the `HTTPService` POST request fails with an error. This caused us to receive the following error when running the tests: 2) WorkbenchImportWorker multireferential zipfile with error downloads a zip file, cuts it, and uploads some pieces Failure/Error: expect { worker.perform import.id }.to raise_error( StopIteration, post_response_failure.body ) expected StopIteration with {:error=>"What was you thinking"}, got #<StopIteration: {:error=>"What was you thinking"}> with backtrace: # ./app/workers/workbench_import_worker.rb:63:in `upload_entry_group' # ./app/workers/workbench_import_worker.rb:38:in `each' # ./app/workers/workbench_import_worker.rb:38:in `each_with_index' # ./app/workers/workbench_import_worker.rb:38:in `upload' # ./app/workers/workbench_import_worker.rb:15:in `perform' # ./spec/workers/workbench_import_worker_spec.rb:105:in `block (4 levels) in <top (required)>' # ./spec/workers/workbench_import_worker_spec.rb:105:in `block (3 levels) in <top (required)>' # -e:1:in `<main>' # ./spec/workers/workbench_import_worker_spec.rb:105:in `block (3 levels) in <top (required)>' # -e:1:in `<main>' In order to get around this, just catch the error. Hopefully this is right.
2017-09-05WorkbenchImportWorker spec: Mock upload paramsTeddy Wing
Was getting this error as a result of the new parameters expected in `mock_post`: 2) WorkbenchImportWorker multireferential zipfile with error downloads a zip file, cuts it, and uploads some pieces Failure/Error: HTTPService.post_resource( host: export_host, path: export_path, params: params(eg_file, eg_name)) HTTPService received :post_resource with unexpected arguments expected: ({:host=>"http://www.example.com", :path=>"/api/v1/netex_imports.json", :params=>{:netex_import=>{:par... @original_filename="subdir 0.zip", @local_path="local.path", @io=#<Double "subdir 0">, @opts={}>}}}) got: ({:host=>"http://www.example.com", :path=>"/api/v1/netex_imports.json", :params=>{:netex_import=>{:par.../stif-boiv/tmp/imports/WorkbenchImport_subdir 0_38821.zip>, @opts={}>}}}) Diff: @@ -7,5 +7,5 @@ :workbench_id=>1019, :name=>"subdir 0", :file=> - #<UploadIO:0x007f9bd144dbe8 @content_type="application/zip", @original_filename="subdir 0.zip", @local_path="local.path", @io=#<Double "subdir 0">, @opts={}>}}}] + #<UploadIO:0x007f9bd14a1450 @content_type="application/zip", @original_filename="subdir 0.zip", @local_path="/.../stif-boiv/tmp/imports/WorkbenchImport_subdir 0_38821.zip", @io=#<File:/.../stif-boiv/tmp/imports/WorkbenchImport_subdir 0_38821.zip>, @opts={}>}}}] # ./app/workers/workbench_import_worker.rb:29:in `execute_post' # ./app/workers/workbench_import_worker.rb:59:in `upload_entry_group' # ./app/workers/workbench_import_worker.rb:38:in `each' # ./app/workers/workbench_import_worker.rb:38:in `each_with_index' # ./app/workers/workbench_import_worker.rb:38:in `upload' # ./app/workers/workbench_import_worker.rb:15:in `perform' # ./spec/workers/workbench_import_worker_spec.rb:105:in `block (3 levels) in <top (required)>' # -e:1:in `<main>' To get around this, decided to just mock the `HTTPService#upload` method because I don't really care about these attributes.
2017-09-05WorkbenchImportWorker spec: Use `subdirs` in place of `entry_groups`Teddy Wing
Since the concept of `entry_groups` was changed to `subdirs`, this change needs to be reflected in the tests. Instead of looping over `entry_groups`, we now loop over `subdirs`, and pass this object directly to `mock_post`. The `mock_post` helper is now rewritten to reflect the new structure of post parameters. Remove the `params` `let` because it's not used anywhere else and we need to pass the arguments to `mock_post` into it. This currently errors because `Faraday::UploadIO` isn't passed the parameters that are expected in `mock_post`.
2017-09-04WorkbenchImportWorker spec: Change `entry_group_streams` to `subdirs`Teddy Wing
This changed in the new `ZipService`. We're now using a `Subdir` object, we we need to use that in the tests instead of the `entry_group_streams`.
2017-08-31WorkbenchImportWorker spec: Allow mock call to update `started_at`Teddy Wing
The code in `#perform` now updates the `started_at` time field which breaks the existing mocks. Update them to match the code. Yes, T-not-DD.
2017-08-31WorkbenchImportWorker spec: Reinstate testsTeddy Wing
Don't skip these any more. Working to figure out how to make new specs that work with the new code.
2017-08-25Temporarily skip WorkbenchImportWorker testsTeddy Wing
These tests broke because the ZipService changed. Since they seem to require a lot of modifications or rewrites in order to get them back in working order, skip them for now until I can revisit them next week.
2017-08-25WorkbenchImportWorker spec: Change `#update_attributes` to `#update`Teddy Wing
Now that the code has been changed to use `#update`, update these test mocks to bind to the right method.
2017-08-25WorkbenchImportWorker spec: Remove use of `RetryService`Teddy Wing
The `RetryService` is not used any more, so this code that uses it should be removed.
2017-08-01Refs: #3507@2h; CR Step 4Robert
- Added tests for HTTPService (regression) - Removed some dead code (Workbench model spec, Import factory) - Changed front_end_host to rails_host in config
2017-07-31Refs: #3507@3h; CR finishedRobert
2017-07-31Refs: #3507@2h CR 2nd legRobert
2017-07-31Refs: #3507_1726@6h Code ReviewRobert
2017-07-27Refs: 3507@2.5h; Specing WorkbenchImportWorker failure and DB behaviorRobert
- speced and implemented Import instance behavior (status, total_steps, current_step) - failure behavior and it's impact to the above
2017-07-26Refs: #3507@4h; Finished Basic WorkbenchImportWorkerRobert
- speced but missing error treatment
2017-07-25Refs: #3507;20h Specing and Implementing the ZipServiceRobert
2017-07-21Sketching out the unzip/zip process, need to change Tempfile to ↵Robert
File.open(..., r) in a configurable directory [amend me]
2017-07-21Refs: #3507@4.5h spec setup and refactoring, using Faraday in workerRobert
- Setting up correct headers for the Webmock request (Oh Boy) - Refactoring all Faraday requests into `lib/af83/http_fetcher.rb` - Implementing the Download
2017-07-20Refs: #3507@1hRobert
Introduction of Presence Validation in Import model, for: - workbench - referential
2017-07-20Refs: #3507@1h; Merge with 1726_... and validations on NetexImportRobert
2017-07-20bup working on WorkbenchImportWorker's integration spec [amend me]Robert
2017-06-09refs 3604 @12h all tests passRobert
2017-06-06Refs: #3604; added tests for cloning with data ⇒ ✓Robert
2017-04-19removed obsolete migration 20170123131243_set_user_permissions.rb; Refs #3105Robert
2017-04-18clone_schema fixed -> lib/sql/clone_schema.sql; ↵RobertDober
lib/af83/stored_procedures.rb for sql stored procedure management; Refs #2864