From 2fc02c183221d4a5220a53e14602640445bddb5b Mon Sep 17 00:00:00 2001 From: Chelsea Holland Komlo Date: Wed, 28 Mar 2018 13:18:13 -0400 Subject: [PATCH] fix up test for file content changes --- command/agent/agent_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index 7b0e7c2b0..292623123 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -982,10 +982,22 @@ func TestServer_ShouldReload_ReturnTrueForFileChanges(t *testing.T) { -----END CERTIFICATE----- ` - err = ioutil.WriteFile(tmpfn, []byte(newCertificate), 0644) + os.Remove(tmpfn) + err = ioutil.WriteFile(tmpfn, []byte(newCertificate), 0666) require.Nil(err) - shouldReloadAgent, shouldReloadHTTP, shouldReloadRPC = agent.ShouldReload(agentConfig) + newAgentConfig := &Config{ + TLSConfig: &sconfig.TLSConfig{ + EnableHTTP: true, + EnableRPC: true, + VerifyServerHostname: true, + CAFile: cafile, + CertFile: tmpfn, + KeyFile: key, + }, + } + + shouldReloadAgent, shouldReloadHTTP, shouldReloadRPC = agent.ShouldReload(newAgentConfig) require.True(shouldReloadAgent) require.True(shouldReloadHTTP) require.True(shouldReloadRPC)