blob: d47d6e4f7aa9583861dc7f5e31ed795c6b7f5037 (
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# file : tests/cfg-add.testscript
# license : MIT; see accompanying LICENSE file
.include common.testscript
cfg_create += 2>!
# @@ To verify the association result use cfg-list command rather than
# pkg-status, when implemented.
#
test.arguments += -d cfg
cfg_uuid = '18f48b4b-b5d9-4712-b98c-1930df1c4228'
acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
: success
:
{
$cfg_create -d cfg --name 'main';
$cfg_create -d acfg --name 'shared' --config-uuid "$acfg_uuid" &acfg/***;
# Try to associate configuration under the same name.
#
$* cfg 2>>/~"%EOE%" != 0;
%error: associating configuration .+/cfg/ with itself%
% info: uuid: .{36}%
EOE
# Try to associate configuration under the same name.
#
$* acfg --name 'main' 2>>/~"%EOE%" != 0;
%error: associating configuration .+/acfg/ using current configuration name 'main'%
info: consider specifying alternative name with --name
EOE
# Associate configuration.
#
$* acfg 2>>/~"%EOE%";
%associated configuration .+/acfg/%
info: uuid: $acfg_uuid
info: type: target
info: name: shared
info: id: 1
EOE
$pkg_status -d cfg libfoo >'libfoo unknown';
$pkg_status -d acfg libfoo >'libfoo unknown';
# Test that the recreated configuration can be implicitly re-associated.
#
rm -r cfg;
$cfg_create -d cfg --name 'test' --config-uuid "$cfg_uuid" &cfg/***;
$* acfg 2>>/~"%EOE%";
%warning: current configuration .+/cfg/ is already implicitly associated with .+/acfg/%
%associated configuration .+/acfg/%
info: uuid: $acfg_uuid
info: type: target
info: name: shared
info: id: 1
EOE
# Test that the repeated association is reported.
#
$* acfg 2>>/~%EOE% != 0;
%error: configuration with uuid .{36} is already associated as \.\./acfg/%
EOE
rm -r acfg;
$cfg_create -d acfg --name 'shared' &acfg/***;
# Test that the path clash is reported.
#
$* acfg 2>>/~%EOE% != 0;
%error: configuration with path .+/acfg/ is already associated%
EOE
# Test that the name clash is reported.
#
$cfg_create -d acfg2 --name 'shared' &acfg2/***;
$* acfg2 --name 'shared' 2>>/EOE != 0;
error: configuration with name shared is already associated as ../acfg/
info: consider specifying alternative name with --name
EOE
$* acfg2 2>>/~%EOE%;
warning: configuration with name shared is already associated as ../acfg/, associating as unnamed
%associated configuration .+/acfg2/%
% info: uuid: .{36}%
info: type: target
info: id: 2
EOE
# Test that the integrity check fails.
#
$pkg_status -d cfg libfoo 2>>/~"%EOE%" != 0;
error: configuration acfg/ uuid mismatch
% info: uuid .+%
info: associated with cfg/ as $acfg_uuid
EOE
# Associate the second configuration.
#
rm -r acfg;
$cfg_create -d acfg --name 'shared' --config-uuid "$acfg_uuid" &acfg/***;
$pkg_status -d cfg libfoo >'libfoo unknown';
$pkg_status -d acfg2 libfoo >'libfoo unknown';
# Test that the configuration type mismatch is reported.
#
mv cfg cfg.tmp;
$cfg_create -d cfg --type host --config-uuid "$cfg_uuid";
$* -d acfg2 cfg 2>>/EOE != 0;
error: configuration cfg/ type mismatch
info: type host
info: implicitly associated with acfg2/ as target
EOE
rm -r cfg;
mv cfg.tmp cfg;
# Make the implicit association explicit.
#
$* -d acfg2 cfg 2>>/~"%EOE%";
%associated configuration .+/cfg/%
info: uuid: $cfg_uuid
info: type: target
info: name: test
info: id: 1
EOE
$pkg_status -d cfg libfoo >'libfoo unknown';
$pkg_status -d acfg2 libfoo >'libfoo unknown';
$* -d acfg2 cfg 2>>/~%EOE% != 0;
%error: configuration with uuid .{36} is already associated as \.\./cfg/%
EOE
# Test that the reverse association path clash is reported.
#
rm -r cfg;
$cfg_create -d cfg --name 'test' &cfg/***;
$* acfg2 2>>/~%EOE% != 0;
%error: current configuration .+/cfg/ is already associated with .+/acfg2/%
EOE
# Test that the repeated reverse association is reported.
#
$cfg_create -d cfg2 --config-uuid "$cfg_uuid";
$* -d cfg2 acfg2 2>>/~"%EOE%" != 0;
%error: current configuration $cfg_uuid is already associated with .+/acfg2/%
EOE
# Make sure that current configuration is reverse associated as unnamed.
#
# @@ Make sure that's really the case when the cfg-list command is
# implemented.
#
rm -r cfg2;
$cfg_create -d cfg2 --name 'test' &cfg2/***;
$* -d cfg2 acfg2 2>>/~%EOE%;
%associated configuration .+/acfg2/%
% info: uuid: .{36}%
info: type: target
info: name: shared
info: id: 1
EOE
# Test that the integrity check fails.
#
$pkg_status -d cfg2 libfoo 2>>/~"%EOE%" != 0;
error: configuration cfg/ uuid mismatch
% info: uuid .+%
info: associated with acfg2/ as $cfg_uuid
EOE
rm -r cfg;
$cfg_create -d cfg --name 'test' --config-uuid "$cfg_uuid" &cfg/***;
$pkg_status -d cfg2 libfoo >'libfoo unknown';
$pkg_status -d acfg2 libfoo >'libfoo unknown'
}
|