Skip to content

Commit

Permalink
chartsvc: integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sameer Naik committed May 25, 2018
1 parent d73aa5e commit d51e1e0
Show file tree
Hide file tree
Showing 2 changed files with 470 additions and 14 deletions.
33 changes: 19 additions & 14 deletions cmd/chartsvc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,7 @@ import (

var dbSession datastore.Session

func main() {
dbURL := flag.String("mongo-url", "localhost", "MongoDB URL (see https://godoc.org/labix.org/v2/mgo#Dial for format)")
dbName := flag.String("mongo-database", "charts", "MongoDB database")
dbUsername := flag.String("mongo-user", "", "MongoDB user")
dbPassword := os.Getenv("MONGO_PASSWORD")
flag.Parse()

mongoConfig := datastore.Config{URL: *dbURL, Database: *dbName, Username: *dbUsername, Password: dbPassword}
var err error
dbSession, err = datastore.NewSession(mongoConfig)
if err != nil {
log.WithFields(log.Fields{"host": *dbURL}).Fatal(err)
}

func setupRoutes() http.Handler {
r := mux.NewRouter()

// Healthcheck
Expand All @@ -64,6 +51,24 @@ func main() {

n := negroni.Classic()
n.UseHandler(r)
return n
}

func main() {
dbURL := flag.String("mongo-url", "localhost", "MongoDB URL (see https://godoc.org/labix.org/v2/mgo#Dial for format)")
dbName := flag.String("mongo-database", "charts", "MongoDB database")
dbUsername := flag.String("mongo-user", "", "MongoDB user")
dbPassword := os.Getenv("MONGO_PASSWORD")
flag.Parse()

mongoConfig := datastore.Config{URL: *dbURL, Database: *dbName, Username: *dbUsername, Password: dbPassword}
var err error
dbSession, err = datastore.NewSession(mongoConfig)
if err != nil {
log.WithFields(log.Fields{"host": *dbURL}).Fatal(err)
}

n := setupRoutes()

port := os.Getenv("PORT")
if port == "" {
Expand Down
Loading

0 comments on commit d51e1e0

Please sign in to comment.