Repository: looplab/eventhorizon
Pull request #296 (2021-02-04 09:55:41)

Fix / GCP emulator and MongoDB images
### Description

Updates the GCP emulator and MongoDB images.

### Affected Components

- Dev environment

### Related Issues

### Solution and Design

### Steps to test and verify



Patch:
diff --git a/Makefile b/Makefile
index 7c0565f..ccfc662 100644
--- a/Makefile
+++ b/Makefile
@@ -42,12 +42,12 @@ upload_cover:
 
 .PHONY: run
 run:
-	docker-compose up -d mongo gpubsub kafka
+	docker-compose up -d mongodb gpubsub kafka
 	sleep 15
 
 .PHONY: run_mongodb
 run_mongodb:
-	docker-compose up -d mongo
+	docker-compose up -d mongodb
 
 .PHONY: run_gpubsub
 run_gpubsub:
@@ -66,6 +66,6 @@ clean:
 	@find . -name \.coverprofile -type f -delete
 	@rm -f gover.coverprofile
 
-.PHONY: mongo_shell
-mongo_shell:
-	docker run -it --network eventhorizon_default --rm mongo:4.2 mongo --host mongo test
+.PHONY: mongodb_shell
+mongodb_shell:
+	docker run -it --network eventhorizon_default --rm mongo:4.4 mongo --host mongodb test
diff --git a/docker-compose.yml b/docker-compose.yml
index 6f39de5..83ab4ad 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,19 +4,19 @@ services:
   golang:
     image: golang:1.15
     environment:
-      MONGO_HOST: "mongo:27017"
+      MONGODB_HOST: "mongodb:27017"
       PUBSUB_EMULATOR_HOST: "gpubsub:8793"
     volumes:
       - .:/eventhorizon
     working_dir: /eventhorizon
 
-  mongo:
-    image: mongo:4.2
+  mongodb:
+    image: mongo:4.4
     ports:
       - "27017:27017"
 
   gpubsub:
-    image: google/cloud-sdk:318.0.0
+    image: gcr.io/google.com/cloudsdktool/cloud-sdk:326.0.0-emulators
     ports:
       - "8793:8793"
     entrypoint:
diff --git a/examples/todomvc/backend/main.go b/examples/todomvc/backend/main.go
index 59f0b9f..66626ce 100644
--- a/examples/todomvc/backend/main.go
+++ b/examples/todomvc/backend/main.go
@@ -44,7 +44,7 @@ func main() {
 	log.Println("starting TodoMVC backend")
 
 	// Use MongoDB in Docker with fallback to localhost.
-	dbURL := os.Getenv("MONGO_HOST")
+	dbURL := os.Getenv("MONGODB_HOST")
 	if dbURL == "" {
 		dbURL = "localhost:27017"
 	}
diff --git a/examples/todomvc/docker-compose.yml b/examples/todomvc/docker-compose.yml
index cf51fe7..4235b47 100644
--- a/examples/todomvc/docker-compose.yml
+++ b/examples/todomvc/docker-compose.yml
@@ -12,12 +12,12 @@ services:
     ports:
       - "8080:8080"
     environment:
-      MONGO_HOST: "mongo:27017"
+      MONGODB_HOST: "mongodb:27017"
       PUBSUB_EMULATOR_HOST: "gpubsub:8793"
       TRACING_URL: "tracing"
 
-  mongo:
-    image: mongo:4.2
+  mongodb:
+    image: mongo:4.4
     ports:
       - "27017:27017"
 


Test patch:
diff --git a/eventstore/mongodb/eventstore_test.go b/eventstore/mongodb/eventstore_test.go
index 8f78e2b..17ed07a 100644
--- a/eventstore/mongodb/eventstore_test.go
+++ b/eventstore/mongodb/eventstore_test.go
@@ -29,7 +29,7 @@ func TestEventStoreIntegration(t *testing.T) {
 	}
 
 	// Use MongoDB in Docker with fallback to localhost.
-	url := os.Getenv("MONGO_HOST")
+	url := os.Getenv("MONGODB_HOST")
 	if url == "" {
 		url = "localhost:27017"
 	}
diff --git a/examples/guestlist/mongodb/mongodb_test.go b/examples/guestlist/mongodb/mongodb_test.go
index ca69277..0b4dc4d 100644
--- a/examples/guestlist/mongodb/mongodb_test.go
+++ b/examples/guestlist/mongodb/mongodb_test.go
@@ -39,7 +39,7 @@ func ExampleIntegration() {
 	}
 
 	// Use MongoDB in Docker with fallback to localhost.
-	url := os.Getenv("MONGO_HOST")
+	url := os.Getenv("MONGODB_HOST")
 	if url == "" {
 		url = "localhost:27017"
 	}
diff --git a/examples/todomvc/backend/handler/handler_test.go b/examples/todomvc/backend/handler/handler_test.go
index e5ecd5d..3aef97d 100644
--- a/examples/todomvc/backend/handler/handler_test.go
+++ b/examples/todomvc/backend/handler/handler_test.go
@@ -749,7 +749,7 @@ func NewIntegrationTestSession(ctx context.Context) (
 	eh.ReadWriteRepo,
 ) {
 	// Use MongoDB in Docker with fallback to localhost.
-	dbURL := os.Getenv("MONGO_HOST")
+	dbURL := os.Getenv("MONGODB_HOST")
 	if dbURL == "" {
 		dbURL = "localhost:27017"
 	}
diff --git a/repo/mongodb/repo_test.go b/repo/mongodb/repo_test.go
index 717073b..50b28a9 100644
--- a/repo/mongodb/repo_test.go
+++ b/repo/mongodb/repo_test.go
@@ -37,7 +37,7 @@ func TestReadRepoIntegration(t *testing.T) {
 	}
 
 	// Local Mongo testing with Docker
-	url := os.Getenv("MONGO_HOST")
+	url := os.Getenv("MONGODB_HOST")
 
 	if url == "" {
 		// Default to localhost
@@ -180,7 +180,7 @@ func TestRepository(t *testing.T) {
 	}
 
 	// Local Mongo testing with Docker
-	url := os.Getenv("MONGO_HOST")
+	url := os.Getenv("MONGODB_HOST")
 	if url == "" {
 		// Default to localhost
 		url = "localhost:27017"