mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-17 01:17:35 +00:00
fix(canonical): make missing-config-yaml test self-contained for CI
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package canonical
|
package canonical
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@@ -34,8 +36,11 @@ func TestLoadMissingProfile(t *testing.T) {
|
|||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
}
|
}
|
||||||
func TestLoadMissingConfigYAML(t *testing.T) {
|
func TestLoadMissingConfigYAML(t *testing.T) {
|
||||||
// testdata/missing_config has no config.yaml — only an empty profiles dir.
|
// Root exists but has no config.yaml — error must call that file out.
|
||||||
_, err := Load("testdata/missing_config")
|
// 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)
|
require.Error(t, err)
|
||||||
assert.Contains(t, err.Error(), "config.yaml")
|
assert.Contains(t, err.Error(), "config.yaml")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user