| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package parity |
| 4 | |
| 5 | import ( |
| 6 | "os" |
| 7 | "path/filepath" |
| 8 | "testing" |
| 9 | |
| 10 | "github.com/stretchr/testify/require" |
| 11 | ) |
| 12 | |
| 13 | func TestLoadManifest_Invalid(t *testing.T) { |
| 14 | tmpDir := t.TempDir() |
| 15 | manifestPath := filepath.Join(tmpDir, "manifest.yaml") |
| 16 | badManifest := `version: v1 |
| 17 | scenarios: |
| 18 | - id: duplicate |
| 19 | protocols: {lldp: true} |
| 20 | fixtures: |
| 21 | - device_id: d1 |
| 22 | walk_file: fixture1.txt |
| 23 | golden_yaml: golden.yaml |
| 24 | golden_json: golden.json |
| 25 | - id: duplicate |
| 26 | protocols: {lldp: true} |
| 27 | fixtures: |
| 28 | - device_id: d2 |
| 29 | walk_file: fixture2.txt |
| 30 | golden_yaml: golden2.yaml |
| 31 | golden_json: golden2.json |
| 32 | ` |
| 33 | require.NoError(t, os.WriteFile(manifestPath, []byte(badManifest), 0o644)) |
| 34 | |
| 35 | _, err := LoadManifest(manifestPath) |
| 36 | require.Error(t, err) |
| 37 | require.ErrorContains(t, err, "duplicate scenario id") |
| 38 | } |