chore: add extra route config tests

This commit is contained in:
Jonas Kaninda
2024-11-18 10:03:58 +01:00
parent 762fbe8511
commit 8f8f9d4d6c
4 changed files with 193 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import (
)
const testPath = "./tests"
const extraRoutePath = "./tests/extra"
var configFile = filepath.Join(testPath, "goma.yml")
@@ -18,11 +19,15 @@ func TestInit(t *testing.T) {
if err != nil {
t.Error(err)
}
err = os.MkdirAll(extraRoutePath, os.ModePerm)
if err != nil {
t.Error(err)
}
}
func TestCheckConfig(t *testing.T) {
TestInit(t)
err := initConfig(configFile)
err := initConfiguration(configFile)
if err != nil {
t.Fatal("Error init config:", err)
}
@@ -35,10 +40,15 @@ func TestCheckConfig(t *testing.T) {
func TestStart(t *testing.T) {
TestInit(t)
err := initConfig(configFile)
err := initConfiguration(configFile)
if err != nil {
t.Fatalf("Error initializing config: %s", err.Error())
}
err = initExtraRoute(extraRoutePath)
if err != nil {
t.Fatalf("Error creating extra routes file: %s", err.Error())
}
ctx := context.Background()
g := GatewayServer{}
gatewayServer, err := g.Config(configFile, ctx)