Skip to content

Commit ee2ca52

Browse files
committed
fix archive test to account for variable generated files
The META files generated in the fake release archive will include the version numbers of the modules used to generate them. This means they can have different content on different machines or different module versions. Use a regex on the content as a sanity check rather than a SHA-1 sum for these files.
1 parent b460dfd commit ee2ca52

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

t/model/archive.t

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ subtest 'archive extraction' => sub {
3030
'bc7f47a8e0e9930f41c06e150c7d229cfd3feae7',
3131
'Some-1.00-TRIAL/t/00-nop.t' =>
3232
'2eba5fd5f9e08a9dcc1c5e2166b7d7d958caf377',
33-
'Some-1.00-TRIAL/META.json' =>
34-
'075033ae62d19864203ae413822be6846e101556',
35-
'Some-1.00-TRIAL/META.yml' =>
36-
'10f129398229a8b1cff0922d498f5982d976d247',
33+
'Some-1.00-TRIAL/META.json' => qr/"meta-spec"/,
34+
'Some-1.00-TRIAL/META.yml' => qr/provides:/,
3735
'Some-1.00-TRIAL/MANIFEST' =>
3836
'e93d21831fb3d3cac905dbe852ba1a4a07abd991',
3937
);
@@ -50,8 +48,14 @@ subtest 'archive extraction' => sub {
5048

5149
my $dir = $archive->extract;
5250
for my $file ( keys %want ) {
53-
my $digest = sha1_hex( $dir->file($file)->slurp );
54-
is $digest, $want{$file}, "content of $file";
51+
my $content = $dir->file($file)->slurp;
52+
if ( ref $want{$file} ) {
53+
like $content, $want{$file}, "content of $file";
54+
}
55+
else {
56+
my $digest = sha1_hex($content);
57+
is $digest, $want{$file}, "content of $file";
58+
}
5559
}
5660
};
5761

0 commit comments

Comments
 (0)