From 5a632f70170c0ae46807185add91fb5d17ebf9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 20 Mar 2018 16:56:56 +0100 Subject: [PATCH 1/2] fix default-net profile not reverting bootstrap config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera --- repo/config/profile.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repo/config/profile.go b/repo/config/profile.go index a7d4f1fe318..eab44cfb745 100644 --- a/repo/config/profile.go +++ b/repo/config/profile.go @@ -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 From dd23bec97e7627868b61bd7fb7013630e0447e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 30 Mar 2018 20:38:52 +0200 Subject: [PATCH 2/2] profile: fix test profile tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Łukasz Magiera --- repo/config/profile.go | 15 +++++++++++---- test/sharness/t0021-config.sh | 9 +++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/repo/config/profile.go b/repo/config/profile.go index eab44cfb745..d3f1b42d09c 100644 --- a/repo/config/profile.go +++ b/repo/config/profile.go @@ -162,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 { diff --git a/test/sharness/t0021-config.sh b/test/sharness/t0021-config.sh index 5ade07d0326..33b8583ad04 100755 --- a/test/sharness/t0021-config.sh +++ b/test/sharness/t0021-config.sh @@ -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