MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestConvertYAML

Function TestConvertYAML

dgraph/cmd/root_test.go:58–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func 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}

Callers

nothing calls this directly

Calls 2

convertYAMLFunction · 0.85
FatalMethod · 0.80

Tested by

no test coverage detected