(t *testing.T)
| 106 | } |
| 107 | |
| 108 | func TestParseExamplesAfterMarshalling(t *testing.T) { |
| 109 | t.Parallel() |
| 110 | |
| 111 | for _, file := range collectExamples(t) { |
| 112 | t.Run(file, func(t *testing.T) { |
| 113 | t.Parallel() |
| 114 | |
| 115 | cfg, err := Load(t.Context(), NewFileSource(file)) |
| 116 | require.NoError(t, err) |
| 117 | |
| 118 | // Make sure that a config can be marshalled and parsed again. |
| 119 | // We've had marshalling issues in the past. |
| 120 | buf, err := yaml.Marshal(cfg) |
| 121 | require.NoError(t, err) |
| 122 | |
| 123 | // The marshalled bytes are always YAML, so re-load them under a |
| 124 | // .yaml-named source even when the original example was HCL. |
| 125 | name := strings.TrimSuffix(file, filepath.Ext(file)) + ".yaml" |
| 126 | _, err = Load(t.Context(), NewBytesSource(name, buf)) |
| 127 | require.NoError(t, err) |
| 128 | }) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | // TestHCLExamplesMatchYAML verifies that every .hcl example file produces a |
| 133 | // configuration identical to its .yaml sibling, ensuring the HCL surface |
nothing calls this directly
no test coverage detected