Skip to content

Commit dd23bec

Browse files
committed
profile: fix test profile tests
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
1 parent 5a632f7 commit dd23bec

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

repo/config/profile.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,21 @@ fetching may be degraded.
162162
}
163163

164164
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{}
166167
for _, f := range a {
167-
m[f] = struct{}{}
168+
if !m[f] {
169+
out = append(out, f)
170+
}
171+
m[f] = true
168172
}
169173
for _, f := range b {
170-
m[f] = struct{}{}
174+
if !m[f] {
175+
out = append(out, f)
176+
}
177+
m[f] = true
171178
}
172-
return mapKeys(m)
179+
return out
173180
}
174181

175182
func deleteEntries(arr []string, del []string) []string {

test/sharness/t0021-config.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,13 @@ test_config_cmd() {
212212

213213
test_profile_apply_revert server local-discovery
214214

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
217222

218223
# won't work as it changes datastore definition, which makes ipfs not launch
219224
# without converting first

0 commit comments

Comments
 (0)