Remove exception when deleting files (#6729)

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
Josh Elliott 2024-01-04 01:53:01 -06:00 committed by GitHub
parent d9eee6ef3e
commit 350d2eb7a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 102 deletions

View File

@ -65,17 +65,6 @@ CLASS zcl_abapgit_transport_objects IMPLEMENTATION.
iv_data = ls_local_file-file-data ).
ENDIF.
WHEN zif_abapgit_definitions=>c_state-deleted.
* SUSC, see https://github.com/abapGit/abapGit/issues/2772
IF ls_transport_object-delflag = abap_false
AND ls_transport_object-object <> 'SUSC'
AND ls_transport_object-object <> 'IWOM'
AND ls_transport_object-object <> 'IWMO'
AND ls_transport_object-object <> 'IWSG'
AND ls_transport_object-object <> 'IWSV'.
zcx_abapgit_exception=>raise( |Object { ls_transport_object-object }|
&& | { ls_transport_object-obj_name } should be removed,|
&& | but has NO deletion flag in transport| ).
ENDIF.
io_stage->rm(
iv_path = ls_object_status-path
iv_filename = ls_object_status-filename ).

View File

@ -1,4 +1,3 @@
CLASS ltcl_transport_objects DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
@ -10,12 +9,7 @@ CLASS ltcl_transport_objects DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HA
cant_be_added_with_del_flag FOR TESTING RAISING cx_static_check,
cant_be_modified_with_del_flag FOR TESTING RAISING cx_static_check,
deleted_to_removed_files FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwmo FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwom FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwsg FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwsv FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_susc FOR TESTING RAISING cx_static_check,
shouldnt_remove_no_delflag FOR TESTING RAISING cx_static_check,
should_remove_no_delflag FOR TESTING RAISING cx_static_check,
should_add_all_local_files FOR TESTING RAISING cx_static_check,
should_delete_all_related FOR TESTING RAISING cx_static_check,
setup,
@ -90,6 +84,7 @@ CLASS ltcl_transport_objects IMPLEMENTATION.
then_file_should_be_added( ls_local_file ).
ENDMETHOD.
METHOD modified_to_new_local_files.
DATA ls_local_file TYPE zif_abapgit_definitions=>ty_file_item.
given_the_transport_object(
@ -113,6 +108,7 @@ CLASS ltcl_transport_objects IMPLEMENTATION.
then_file_should_be_added( ls_local_file ).
ENDMETHOD.
METHOD should_add_all_local_files.
"Not only .abap, but also .xml and other includes
DATA ls_abap_local_file TYPE zif_abapgit_definitions=>ty_file_item.
@ -153,6 +149,7 @@ CLASS ltcl_transport_objects IMPLEMENTATION.
then_file_should_be_added( ls_abap_local_file ).
then_file_should_be_added( ls_xml_local_file ).
ENDMETHOD.
METHOD transport_not_in_repository.
given_the_transport_object(
iv_obj_name = 'CL_A_CLASS_NOT_IN_REPO'
@ -267,100 +264,20 @@ CLASS ltcl_transport_objects IMPLEMENTATION.
iv_path = '/a_path' ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwmo.
METHOD should_remove_no_delflag.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWMO'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWMO'
iv_filename = 'zfoo.iwmo.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwom.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWOM'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWOM'
iv_filename = 'zfoo.iwom.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwsg.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSG'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSG'
iv_filename = 'zfoo.iwsg.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwsv.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSV'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSV'
iv_filename = 'zfoo.iwsv.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_susc.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'SUSC'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'SUSC'
iv_filename = 'zfoo.susc.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD shouldnt_remove_no_delflag.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_name = 'ZFOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_filename = 'zfoo.CLAS.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_raise_exception( 'Object CLAS CL_FOO should be removed, but has NO deletion flag in transport' ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD given_the_transport_object.