66 "path/filepath"
77 "testing"
88
9+ "github.com/goccy/go-yaml"
910 "github.com/stretchr/testify/assert"
1011 "github.com/stretchr/testify/require"
1112
@@ -85,6 +86,10 @@ func TestLoadExamples(t *testing.T) {
8586
8687 runConfig := & config.RuntimeConfig {}
8788
89+ type versioned struct {
90+ Version string `yaml:"version"`
91+ }
92+
8893 // Load all the examples.
8994 for _ , agentFilename := range examples {
9095 t .Run (agentFilename , func (t * testing.T ) {
@@ -93,6 +98,16 @@ func TestLoadExamples(t *testing.T) {
9398 agentSource , err := config .Resolve (agentFilename )
9499 require .NoError (t , err )
95100
101+ // First make sure it doesn't define a version
102+ data , err := agentSource .Read (t .Context ())
103+ require .NoError (t , err )
104+
105+ var v versioned
106+ err = yaml .Unmarshal (data , & v )
107+ require .NoError (t , err )
108+ require .Empty (t , v .Version , "example %s should not define a version" , agentFilename )
109+
110+ // Then make sure the config loads successfully
96111 teams , err := Load (t .Context (), agentSource , runConfig )
97112 require .NoError (t , err )
98113 assert .NotEmpty (t , teams )
0 commit comments