Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
added exit code and fixed mongo get user test
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrichardsmith committed Dec 22, 2016
1 parent c3a4278 commit 7615773
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions db/mongodb/mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package mongodb

import (
"fmt"
"os"
"testing"

"github.com/microservices-demo/user/users"
Expand Down Expand Up @@ -33,13 +34,13 @@ func TestMain(m *testing.M) {
TestMongo.Session = TestServer.Session()
TestMongo.EnsureIndexes()
TestMongo.Session.Close()
defer exitTest()
m.Run()
exitTest(m.Run())
}

func exitTest() {
func exitTest(i int) {
TestServer.Wipe()
TestServer.Stop()
os.Exit(i)
}

func TestInit(t *testing.T) {
Expand Down Expand Up @@ -133,7 +134,7 @@ func TestGetUserByName(t *testing.T) {
func TestGetUser(t *testing.T) {
TestMongo.Session = TestServer.Session()
defer TestMongo.Session.Close()
_, err := TestMongo.GetUser("1")
_, err := TestMongo.GetUser(TestUser.UserID)
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit 7615773

Please sign in to comment.