fix(canonical): make missing-config-yaml test self-contained for CI

This commit is contained in:
2026-05-23 13:06:32 +01:00
parent 9d3c386f1d
commit 2334ed7922
+7 -2
View File
@@ -1,6 +1,8 @@
package canonical
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
@@ -34,8 +36,11 @@ func TestLoadMissingProfile(t *testing.T) {
assert.Error(t, err)
}
func TestLoadMissingConfigYAML(t *testing.T) {
// testdata/missing_config has no config.yaml — only an empty profiles dir.
_, err := Load("testdata/missing_config")
// Root exists but has no config.yaml — error must call that file out.
// Built at runtime so we don't depend on git tracking empty dirs (it doesn't).
root := t.TempDir()
require.NoError(t, os.MkdirAll(filepath.Join(root, "profiles"), 0o750))
_, err := Load(root)
require.Error(t, err)
assert.Contains(t, err.Error(), "config.yaml")
}