Skip to content

Commit

Permalink
Remove empty strings from test initialdata dump for Oracle
Browse files Browse the repository at this point in the history
As empty strings are stored as NULL in Oracle, they are not dumped.
  • Loading branch information
sunnavy committed Sep 18, 2023
1 parent 0e0d8de commit c29acbe
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions t/api/initialdata_copy_queue.t
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,24 @@ my $expected_changes = JSON::decode_json(<<'EOF');
}
EOF

# Remove empty strings as they are stored as NULL in Oracle and thus not dumped
if ( RT->Config->Get('DatabaseType') eq 'Oracle' ) {
for my $type ( keys %$expected_changes ) {
for my $item ( @{ $expected_changes->{$type} } ) {
for my $field ( keys %$item ) {
if ( $field eq '_Original' ) {
for my $orig_field ( keys %{ $item->{$field} } ) {
delete $item->{$field}{$orig_field} if $item->{$field}{$orig_field} eq '';
}
}
elsif ( $item->{$field} eq '' ) {
delete $item->{$field};
}
}
}
}
}

is_deeply( JSON::decode_json($changes), $expected_changes, 'Generated changes look good' );

diag "Import queue Test with a new name";
Expand Down

0 comments on commit c29acbe

Please sign in to comment.