chore(test): enhance error handling and avoid repetitions

This commit is contained in:
2024-12-17 18:22:45 +01:00
parent 131ea5d569
commit 41a4292939
2 changed files with 31 additions and 15 deletions

View File

@@ -21,7 +21,7 @@ services:
composeFileContent = fmt.Sprintf(composeFileContent, labels.KatenaryLabelPrefix)
tmpDir, err := os.MkdirTemp("", "katenary-test-override")
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
composeFile := filepath.Join(tmpDir, "compose.yaml")
@@ -38,6 +38,9 @@ services:
cli.WithDefaultConfigPath,
)
project, err := cli.ProjectFromOptions(options)
if err != nil {
t.Fatal(err)
}
if err := fixPorts(&project.Services[0]); err != nil {
t.Errorf("Expected no error, got %s", err)
}
@@ -66,7 +69,7 @@ services:
composeFileContent = fmt.Sprintf(composeFileContent, labels.KatenaryLabelPrefix)
tmpDir, err := os.MkdirTemp("", "katenary-test-override")
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
composeFile := filepath.Join(tmpDir, "compose.yaml")
@@ -83,6 +86,9 @@ services:
cli.WithDefaultConfigPath,
)
project, err := cli.ProjectFromOptions(options)
if err != nil {
t.Fatal(err)
}
if err := fixPorts(&project.Services[0]); err != nil {
t.Errorf("Expected no error, got %s", err)
}