blob: d43c567c3ff9b3649a9e057365c9dce1b4d0e772 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# file : tests/upload/upload-bindist.testscript
# license : MIT; see accompanying LICENSE file
.include data.testscript
: args
{
: no-dir
:
$* 2>>~%EOE% != 0
%\[.+\] \[brep:error\] \[ref \] \[brep-upload-bindist\]: usage: .+brep-upload-bindist \[<options>\] <root> <dir>%
EOE
: no-root
:
$* $~/dir 2>>~%EOE% != 0
%\[.+\] \[brep:error\] \[ref dir\] \[brep-upload-bindist\]: usage: .+brep-upload-bindist \[<options>\] <root> <dir>%
EOE
: root-not-exist
:
: While at it, also test that the trailing slash is stripped from the
: directory paths.
:
$* $~/root/ $~/dir/ 2>>~%EOE% != 0
%\[.+\] \[brep:error\] \[ref dir\] \[brep-upload-bindist\]: '.+root' does not exist or is not a directory%
EOE
: data-not-exist
:
mkdir root;
$* $~/root $~/dir 2>>~%EOE% != 0
%\[.+\] \[brep:error\] \[ref dir\] \[brep-upload-bindist\]: '.+dir' does not exist or is not a directory%
EOE
}
: success
:
{
mkdir --no-cleanup bindist-root/ &bindist-root/***;
# Test the first upload.
#
$clone_data;
$* $~/bindist-root/ $~/$data_dir >>"EOO";
: 1
status: 200
message: binary distribution packages are published
reference: $request_id
EOO
timestamp = '2023-05-08T09:18:20Z';
tenant = '4d4c8b36-56c5-42e0-91d1-58bfd1228002';
dir = [dir_path] bindist-root/$tenant/archive/fedora35/hello/libhello/1.1.0+10/;
test -f $dir/default/libhello-1.0.0+10.tar.xz;
test -f $dir/default-$timestamp/libhello-1.0.0+10.tar.xz;
# Repeat the upload using the same timestamp to make sure that we properly
# handle this situation (by adding the retry number as a suffix to the
# package configuration directory name).
#
$clone_data;
$* $~/bindist-root/ $~/$data_dir >>"EOO" &bindist-root/***;
: 1
status: 200
message: binary distribution packages are published
reference: $request_id
EOO
test -f $dir/default/libhello-1.0.0+10.tar.xz;
test -f $dir/default-$timestamp-0/libhello-1.0.0+10.tar.xz;
test -d $dir/default-$timestamp/ != 0;
# Test the second upload without --keep-previous option.
#
data_dir2 = 22222222-2222-2222-2222-222222222222;
request_id2 = $data_dir2;
timestamp2 = '2023-05-09T09:18:20Z';
cp --no-cleanup -r ../$data_dir ./$data_dir2;
sed -i -e "s%^\(id:\) .+\$%\\1 $request_id2%" \
$data_dir2/request.manifest;
sed -i -e "s%^\(timestamp:\) .+\$%\\1 $timestamp2%" \
$data_dir2/request.manifest;
$* $~/bindist-root/ $~/$data_dir2 >>"EOO";
: 1
status: 200
message: binary distribution packages are published
reference: $request_id2
EOO
test -f $dir/default/libhello-1.0.0+10.tar.xz;
test -f $dir/default-$timestamp2/libhello-1.0.0+10.tar.xz;
test -d $dir/default-$timestamp.0/ != 0;
# Test the third upload with --keep-previous option.
#
data_dir3 = 33333333-3333-3333-3333-333333333333;
request_id3 = $data_dir3;
timestamp3 = '2023-05-10T09:18:20Z';
cp --no-cleanup -r ../$data_dir ./$data_dir3;
sed -i -e "s%^\(id:\) .+\$%\\1 $request_id3%" \
$data_dir3/request.manifest;
sed -i -e "s%^\(timestamp:\) .+\$%\\1 $timestamp3%" \
$data_dir3/request.manifest;
$* --keep-previous $~/bindist-root/ $~/$data_dir3 >>"EOO";
: 1
status: 200
message: binary distribution packages are published
reference: $request_id3
EOO
test -f $dir/default/libhello-1.0.0+10.tar.xz;
test -f $dir/default-$timestamp3/libhello-1.0.0+10.tar.xz;
test -f $dir/default-$timestamp2/libhello-1.0.0+10.tar.xz
}
|