Skip to Content
Hands-On Microservices with Kubernetes
book

Hands-On Microservices with Kubernetes

by Gigi Sayfan
July 2019
Intermediate to advanced
502 pages
14h
English
Packt Publishing
Content preview from Hands-On Microservices with Kubernetes

Implementing database test helpers

Before diving into the code, let's consider what we want to accomplish. We want a local empty database to be created. We want to launch it as a Docker container, but only if it's not running already. In order to do that, we need to check whether a Docker container is running already, if we should restart it, or if we should run a new one. Then, we will try to connect to the target database and create it if it doesn't exist. The service will be responsible for creating the schema if needed because the generic DB utilities know nothing about the database schema of specific services.

The db_util.go file in the db_util package contains all the helpers functions. First, let's review the imports that include the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes Microservices

Kubernetes Microservices

Richard Chesterwood
Cloud Native DevOps with Kubernetes

Cloud Native DevOps with Kubernetes

John Arundel, Justin Domingus
Microservices: Up and Running

Microservices: Up and Running

Ronnie Mitra, Irakli Nadareishvili

Publisher Resources

ISBN: 9781789805468Supplemental Content