Distributed Services with Go: Secure Your Services final make test fails (page 141)

Just a note for other readers as I have resolved my issue.

On page 141 of the text, we are told to update our TLSConfig in the test to enable client verification on the server. The code block looks as such:

serverTLSConfig, err := config.SetupTLSConfig(config.TLSConfig{
	CertFile:      config.ServerCertFile,
	KeyFile:       config.ServerKeyFile,
	CAFile:        config.CAFile,
	ServerAddress: l.Addr().String(),
	Server: true,
})

where Server: true, is newly added to the config. This will cause the tests to fail given the state of the code and specifically the state of the client configuration in the tests. First, the following change to internal/config/files.go should be made:

var (
	CAFile         = configFile("ca.pem")
	ClientCertFile = configFile("client.pem")
	ClientKeyFile  = configFile("client-key.pem")
	ServerCertFile = configFile("server.pem")
	ServerKeyFile  = configFile("server-key.pem")
)

where ClientCertFile and ClientKeyFile are newly added. As such, we should also update our client config in our tests to reference the files (the actual files should have been generated by a run of make gencert that the book has already had us do). The code in the tests should look as such:

clientTLSConfig, err := config.SetupTLSConfig(
	config.TLSConfig{
		CertFile: config.ClientCertFile,
		KeyFile: config.ClientKeyFile,
		CAFile: config.CAFile,
		Server: false,
	},
)

I hope this helps you if you come across this problem.