bscharm

bscharm

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.

Where Next?

Popular Pragmatic Bookshelf topics Top

New
telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
jeffmcompsci
Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list) Typo:...
New
jdufour
Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
New

Other popular topics Top

Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New

Sub Categories: