Skip to content

Commit ed76676

Browse files
committed
Fix config test
1 parent add5f66 commit ed76676

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

internal/config/config_test.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package config
22

33
import (
4+
"strings"
45
"testing"
56
"time"
67

@@ -130,16 +131,26 @@ func TestConfig(t *testing.T) {
130131
}
131132
})
132133

133-
t.Run("Improve yaml parse error msg", func(t *testing.T) {
134-
// TODO: Revisit this test - currently failing in CI
135-
// Test validates YAML parsing error messages. May be related to JIRA tickets GCEA-1781, GCEA-1782.
136-
// The testdata/space-issue.yaml file may not exist or parsing behavior differs in CI.
137-
t.Skip("Skipping until YAML parse error handling can be reviewed - see GCEA-1781, GCEA-1782")
138-
134+
t.Run("should return helpful error for malformed YAML", func(t *testing.T) {
135+
// The space-issue.yaml has intentional formatting problems (inconsistent indentation)
136+
// This test verifies that the parser returns a helpful error message
139137
args := []string{"yc", "-c", "testdata/space-issue.yaml"}
140138
err := ParseFlags(args)
141-
if err != nil {
142-
t.Fatal(err)
139+
140+
// Should return an error for malformed YAML
141+
if err == nil {
142+
t.Fatal("expected error for malformed YAML file, got nil")
143+
}
144+
145+
// Error message should include the file path for context
146+
errMsg := err.Error()
147+
if !strings.Contains(errMsg, "space-issue.yaml") {
148+
t.Errorf("error message should include file path, got: %s", errMsg)
149+
}
150+
151+
// Error message should include line number from YAML parser
152+
if !strings.Contains(errMsg, "line") {
153+
t.Errorf("error message should include line number, got: %s", errMsg)
143154
}
144155
})
145156
}

0 commit comments

Comments
 (0)