3 class RemoteResetTest < ActionDispatch::IntegrationTest
4 self.use_transactional_fixtures = false
6 test "roll back database change" do
7 active_auth = auth(:active)
8 admin_auth = auth(:admin)
10 old_uuid = specimens(:owned_by_active_user).uuid
13 post '/database/reset', {}, admin_auth
14 assert_response :success
16 delete '/arvados/v1/specimens/' + old_uuid, {}, active_auth
17 assert_response :success
18 post '/arvados/v1/specimens', {specimen: '{}'}, active_auth
19 assert_response :success
20 new_uuid = json_response['uuid']
22 # Perhaps redundant: confirm the above changes are observable from
23 # here using get(). Otherwise, the assertions below would not be
24 # informative. (Aside from confirming that integration-testing
25 # features work, this confirms that /database/reset didn't somehow
26 # put the database into a "don't persist any changes" mode -- not
27 # that I can think of a way for that to happen.)
28 get '/arvados/v1/specimens/'+new_uuid, {}, active_auth
29 assert_response :success
30 get '/arvados/v1/specimens/'+old_uuid, {}, active_auth
34 post '/database/reset', {}, admin_auth
35 assert_response :success
37 # New speciment should disappear. Old specimen should reappear.
38 get '/arvados/v1/specimens/'+new_uuid, {}, active_auth
40 get '/arvados/v1/specimens/'+old_uuid, {}, active_auth
41 assert_response :success
42 assert_empty Specimen.where(uuid: new_uuid)