chore(errors): Better error management
We must remove all "Fatal" calls and use errors instead, to be returned and managed globally. This is the first step, but it is, at this time, a real problem. Tests are complicated without this.
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/compose-spec/compose-go/types"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
@@ -73,3 +74,19 @@ services:
|
||||
t.Errorf("Expected FOO to be baz, got %s", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppendBadFile(t *testing.T) {
|
||||
cm := NewConfigMap(types.ServiceConfig{}, "app", true)
|
||||
err := cm.AppendFile("foo")
|
||||
if err == nil {
|
||||
t.Errorf("Expected error, got nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppendBadDir(t *testing.T) {
|
||||
cm := NewConfigMap(types.ServiceConfig{}, "app", true)
|
||||
err := cm.AppendDir("foo")
|
||||
if err == nil {
|
||||
t.Errorf("Expected error, got nil")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user