Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ocakhasan committed Nov 9, 2023
1 parent 7a61150 commit 5f0f195
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
4 changes: 0 additions & 4 deletions internal/controllers/integration_test/mongo_db_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ type TestDatabase struct {
}

func SetupTestDatabase() *TestDatabase {
// setup db container
ctx, _ := context.WithTimeout(context.Background(), time.Second*60)
container, dbInstance, dbAddr, err := createMongoContainer(ctx)
if err != nil {
Expand All @@ -37,7 +36,6 @@ func (tdb *TestDatabase) TearDown() {
}

func createMongoContainer(ctx context.Context) (testcontainers.Container, *mongo.Database, string, error) {

var env = map[string]string{
"MONGO_INITDB_ROOT_USERNAME": "root",
"MONGO_INITDB_ROOT_PASSWORD": "pass",
Expand Down Expand Up @@ -65,8 +63,6 @@ func createMongoContainer(ctx context.Context) (testcontainers.Container, *mongo

log.Println("mongo container ready and running at port: ", p.Port())

time.Sleep(time.Second)

uri := fmt.Sprintf("mongodb://root:pass@localhost:%s", p.Port())
db, err := database.NewMongoDatabase(uri)
if err != nil {
Expand Down

This file was deleted.

28 changes: 28 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,31 @@ Response

To see how the end2end tests are done, please check [integrationtest](internal/controllers/integration_test) folder.

## Run the project

first create the mongo database.

```bash
docker-compose up -d mongo
```

then run

```bash
go run cmd/main.go
```

you will see

```
____ __
/ __/___/ / ___
/ _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.11.3
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
O\
⇨ http server started on [::]:3030
```

0 comments on commit 5f0f195

Please sign in to comment.