MCPcopy Create free account
hub / github.com/github/gh-aw / TestValidateLockSchemaCompatibility

Function TestValidateLockSchemaCompatibility

pkg/workflow/lock_schema_test.go:138–229  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

136}
137
138func TestValidateLockSchemaCompatibility(t *testing.T) {
139 tests := []struct {
140 name string
141 content string
142 lockPath string
143 expectError bool
144 errorText string
145 }{
146 {
147 name: "valid v1 schema",
148 content: `# gh-aw-metadata: {"schema_version":"v1"}
149name: test
150`,
151 lockPath: "test.lock.yml",
152 expectError: false,
153 },
154 {
155 name: "valid v2 schema",
156 content: `# gh-aw-metadata: {"schema_version":"v2","frontmatter_hash":"abc","strict":true}
157name: test
158`,
159 lockPath: "test-v2.lock.yml",
160 expectError: false,
161 },
162 {
163 name: "legacy format is accepted",
164 content: `# frontmatter-hash: 1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
165name: test
166`,
167 lockPath: "legacy.lock.yml",
168 expectError: false,
169 },
170 {
171 name: "valid v3 schema",
172 content: `# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"abc","strict":true}
173name: test
174`,
175 lockPath: "test-v3.lock.yml",
176 expectError: false,
177 },
178 {
179 name: "valid v4 schema",
180 content: `# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"abc","body_hash":"bodyhash"}
181name: test
182`,
183 lockPath: "test-v4.lock.yml",
184 expectError: false,
185 },
186 {
187 name: "unsupported future version fails",
188 content: `# gh-aw-metadata: {"schema_version":"v5"}
189name: test
190`,
191 lockPath: "future.lock.yml",
192 expectError: true,
193 errorText: "unsupported schema version 'v5'",
194 },
195 {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected