Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix default-net profile not reverting bootstrap config #4845

Merged
merged 2 commits into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions repo/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ Inverse profile of the test profile.`,
Transform: func(c *Config) error {
c.Addresses = addressesConfig()

bootstrapPeers, err := DefaultBootstrapPeers()
if err != nil {
return err
}
c.Bootstrap = appendSingle(c.Bootstrap, BootstrapPeerStrings(bootstrapPeers))

c.Swarm.DisableNatPortMap = false
c.Discovery.MDNS.Enabled = true
return nil
Expand Down Expand Up @@ -156,14 +162,21 @@ fetching may be degraded.
}

func appendSingle(a []string, b []string) []string {
m := map[string]struct{}{}
out := make([]string, 0, len(a)+len(b))
m := map[string]bool{}
for _, f := range a {
m[f] = struct{}{}
if !m[f] {
out = append(out, f)
}
m[f] = true
}
for _, f := range b {
m[f] = struct{}{}
if !m[f] {
out = append(out, f)
}
m[f] = true
}
return mapKeys(m)
return out
}

func deleteEntries(arr []string, del []string) []string {
Expand Down
9 changes: 7 additions & 2 deletions test/sharness/t0021-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,13 @@ test_config_cmd() {

test_profile_apply_revert server local-discovery

# won't work as we already have this profile applied
# test_profile_apply_revert test
# tests above mess with values this profile changes, need to do that before testing test profile
test_expect_success "ensure test profile is applied fully" '
ipfs config profile apply test
'

# need to do this in reverse as the test profile is already applied in sharness
test_profile_apply_revert default-networking test

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