(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func TestConvertYAML(t *testing.T) { |
| 59 | hier := ` |
| 60 | mutations: strict |
| 61 | badger: |
| 62 | compression: zstd:1 |
| 63 | goroutines: 5 |
| 64 | raft: |
| 65 | idx: 2 |
| 66 | learner: true |
| 67 | security: |
| 68 | whitelist: "127.0.0.1,0.0.0.0"` |
| 69 | |
| 70 | conv, err := io.ReadAll(convertYAML(hier)) |
| 71 | if err != nil { |
| 72 | t.Fatal("error reading from convertYAML") |
| 73 | } |
| 74 | unchanged, err := io.ReadAll(convertYAML(string(conv))) |
| 75 | if err != nil { |
| 76 | t.Fatal("error reading from convertYAML") |
| 77 | } |
| 78 | if string(unchanged) != string(conv) { |
| 79 | t.Fatal("convertYAML mutating already flattened string") |
| 80 | } |
| 81 | if !strings.Contains(string(conv), "compression=zstd:1; goroutines=5;") || |
| 82 | !strings.Contains(string(conv), "idx=2; learner=true;") || |
| 83 | !strings.Contains(string(conv), "whitelist=127.0.0.1,0.0.0.0") { |
| 84 | t.Fatal("convertYAML not converting properly") |
| 85 | } |
| 86 | } |
nothing calls this directly
no test coverage detected