From 3e797f5088f47770b263e90a192700bc6e7b8de4 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Mon, 26 Oct 2020 18:29:12 +0100 Subject: [PATCH] Add trailing empty line in /etc/hosts that seem to be causing flakiness in name resolution for the last service mentioned Signed-off-by: Guillaume Tardif --- aci/etchosts/hosts.go | 4 ++++ aci/etchosts/testdata/etchosts.golden | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/aci/etchosts/hosts.go b/aci/etchosts/hosts.go index 468197ed3..4e856aa49 100644 --- a/aci/etchosts/hosts.go +++ b/aci/etchosts/hosts.go @@ -33,6 +33,10 @@ func SetHostNames(file string, hosts ...string) error { fmt.Println("Setting local hosts for " + strings.Join(hosts, ", ")) for _, host := range hosts { _, err = f.WriteString("\n127.0.0.1 " + host) + if err != nil { + return err + } } + _, err = f.WriteString("\n") return err } diff --git a/aci/etchosts/testdata/etchosts.golden b/aci/etchosts/testdata/etchosts.golden index 5416fde63..420b850b9 100644 --- a/aci/etchosts/testdata/etchosts.golden +++ b/aci/etchosts/testdata/etchosts.golden @@ -1,4 +1,4 @@ 127.0.0.1 foo 127.0.0.1 bar -127.0.0.1 zot \ No newline at end of file +127.0.0.1 zot