init integration test

This commit is contained in:
2025-04-18 19:32:57 +02:00
parent 81389a2dea
commit 719952dd18
10 changed files with 283 additions and 35 deletions

View File

@@ -8,13 +8,13 @@ import (
)
func (srv *server) DeleteRecipeRelationship( //nolint:revive // not implemented
c *gin.Context, recipeId int, params api.DeleteRecipeRelationshipParams, //nolint:revive // not implemented
c *gin.Context, id int, params api.DeleteRecipeRelationshipParams, //nolint:revive // not implemented
) {
c.JSON(http.StatusServiceUnavailable, gin.H{"msg": "not implemented"})
}
func (srv *server) CreateRecipeRelationship( //nolint:revive // not implemented
c *gin.Context, recipeId int, params api.CreateRecipeRelationshipParams, //nolint:revive // not implemented
c *gin.Context, id int, params api.CreateRecipeRelationshipParams, //nolint:revive // not implemented
) {
c.JSON(http.StatusServiceUnavailable, gin.H{"msg": "not implemented"})
}

View File

@@ -2,22 +2,25 @@ package memgraph
import (
"context"
"log"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
"go.uber.org/zap"
)
func InitDatabase(dbURI, dbUser, dbPassword string) neo4j.DriverWithContext {
func InitDatabase(logger *zap.Logger, dbURI, dbUser, dbPassword string) neo4j.DriverWithContext {
driver, err := neo4j.NewDriverWithContext(dbURI, neo4j.BasicAuth(dbUser, dbPassword, ""))
if err != nil {
log.Panicln(err)
logger.Panic("Unable to init driver due to:", zap.Error(err))
}
ctx := context.Background()
err = driver.VerifyConnectivity(ctx)
if err != nil {
log.Panicln(err)
logger.Panic("Unable to connect to db:", zap.Error(err),
zap.String("dbUser", dbUser),
zap.String("dbURI", dbURI),
)
}
return driver