@cryptotaxi247 / kubo / commits / dd23bec97

profile: fix test profile tests

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Mar 30, 2018 at 20:38 UTC dd23bec97e7627868b61bd7fb7013630e0447e49
2 files changed +18 -6
repo/config/profile.go
+11 -4
@@ -162,14 +162,21 @@ fetching may be degraded.
162 }
163
164 func appendSingle(a []string, b []string) []string {
165 - m := map[string]struct{}{}
165 + out := make([]string, 0, len(a)+len(b))
166 + m := map[string]bool{}
167 for _, f := range a {
167 - m[f] = struct{}{}
168 + if !m[f] {
169 + out = append(out, f)
170 + }
171 + m[f] = true
172 }
173 for _, f := range b {
170 - m[f] = struct{}{}
174 + if !m[f] {
175 + out = append(out, f)
176 + }
177 + m[f] = true
178 }
172 - return mapKeys(m)
179 + return out
180 }
181
182 func deleteEntries(arr []string, del []string) []string {
test/sharness/t0021-config.sh
+7 -2
@@ -212,8 +212,13 @@ test_config_cmd() {
212
213 test_profile_apply_revert server local-discovery
214
215 - # won't work as we already have this profile applied
216 - # test_profile_apply_revert test
215 + # tests above mess with values this profile changes, need to do that before testing test profile
216 + test_expect_success "ensure test profile is applied fully" '
217 + ipfs config profile apply test
218 + '
219 +
220 + # need to do this in reverse as the test profile is already applied in sharness
221 + test_profile_apply_revert default-networking test
222
223 # won't work as it changes datastore definition, which makes ipfs not launch
224 # without converting first