require_relative '../test_config' require 'hws_settings' require 'helix_sync' require 'base64' require 'hws_strings' describe 'HelixSync changes' do include Rack::Test::Methods def app HELIX_WEB_SERVICES_APP end my_project_id = HWSStrings.component_encode('My Project') after(:each) do HWSSettings.settings_handle.HVE_PROJECTS_PATH = nil HWSSettings.system_handle.HELIX_SYNC_LOCK_RETRIES = 30 end context 'GET /helix-sync/v1/:project_id/last-change' do context 'HVE projects' do it 'can fetch the latest change for the project' do HWSSettings.settings_handle.HVE_PROJECTS_PATH = '//depot/main' authorize 'jdoe', ticket_for_jdoe post("/helix-sync/v1/#{my_project_id}/clients/shelf") expect(last_response.status).to eq(200) get("/helix-sync/v1/#{my_project_id}/last-change") expect(last_response.status).to eq(200) info = JSON.parse(last_response.body) expect(info['change'].to_i).to be > 1 end end end context 'GET /helix-sync/v1/:project_id/pending' do context 'default value' do it 'returns the default value if no change found' do authorize 'jdoe', ticket_for_jdoe get('/helix-sync/v1/totally_does_not_exist/pending?default=0') expect(last_response.status).to eq(200) info = JSON.parse(last_response.body) expect(info['change']).to eq('0') end end end context 'POST /helix-sync/v1/:project_id/submit' do context 'locked client' do it 'times out and fails if the client is already locked' do # Let's limit the number of retries HWSSettings.system_handle.HELIX_SYNC_LOCK_RETRIES = 1 lock_client = "_hve_jdoe_#{my_project_id}_shelf_lock" p4 = p4_as_jdoe client_spec = p4.fetch_client(lock_client) p4.client = client_spec._client p4.save_client(client_spec, '-x') authorize 'jdoe', ticket_for_jdoe post("/helix-sync/v1/#{my_project_id}/submit") # # I'm a little surprised this is required here p4.run_client('-d', lock_client) p4.disconnect expect(last_response.status).to eq(400) end end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 16196 | Doug Scheirer | Merge from main | ||
#4 | 16114 | Doug Scheirer | Merge from main | ||
#3 | 16014 | Doug Scheirer | Merge down from main | ||
#2 | 15845 | Doug Scheirer | Integ from main | ||
#1 | 15688 | Doug Scheirer |
Populate -o //guest/perforce_software/helix-web-services/... //guest/doug_scheirer/helix-web-services/.... |
||
//guest/perforce_software/helix-web-services/main/source/helix_web_services/spec/helix_sync/changes_spec.rb | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services/spec/helix_sync/changes_spec.rb | |||||
#6 | 15542 | tjuricek |
Add spaces to our basic 'component encode' mechanism, and use it for HVE project IDs. In general, this will make the HVE IDs a bit more readable. |
||
#5 | 15517 | tjuricek | Do not require changelist ID for submitting Helix Sync pending changelists. | ||
#4 | 15499 | tjuricek | Naive implementation of helix sync project submit for "helix versioning engine projects". | ||
#3 | 15497 | tjuricek | Add support to fetch the latest change of a project. | ||
#2 | 15496 | tjuricek |
Revise GET /helix_sync/v1/changes/[project] to /helix_sync/v1/changes/[project]/pending The base method is really intended for the latest changelist number. Meh. |
||
#1 | 15487 | tjuricek | Add basic ability to create pending changelists for helix sync projects. |