MCPcopy
hub / github.com/XiaoMi/Gaea / TestCheckRandomSQLs

Function TestCheckRandomSQLs

proxy/plan/plan_test.go:129–222  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

127 }
128}
129func TestCheckRandomSQLs(t *testing.T) {
130 randomSqlsFirst := []map[string]map[string][]string{
131 {
132 "slice0": {"db0": {"sql1", "sql2"}, "db1": {"sql1"}},
133 "slice1": {"db2": {"sql1", "sql2"}, "db3": {"sql1"}},
134 },
135 }
136 randomSqlsSecond := []map[string]map[string][]string{
137 {
138 "slice0": {"db0": {"sql1", "sql2"}},
139 },
140 {
141 "slice0": {"db1": {"sql1"}},
142 },
143 {
144 "slice1": {"db2": {"sql1", "sql2"}},
145 },
146 {
147 "slice1": {"db3": {"sql1"}},
148 },
149 }
150 tests := []struct {
151 name string
152 actual map[string]map[string][]string
153 expected bool
154 }{
155 {
156 name: "Normal match",
157 actual: map[string]map[string][]string{
158 "slice0": {"db0": {"sql1", "sql2"}},
159 },
160 expected: true,
161 },
162 {
163 name: "Normal match",
164 actual: map[string]map[string][]string{
165 "slice0": {"db0": {"sql2", "sql1"}},
166 },
167 expected: true,
168 },
169 {
170 name: "Normal match",
171 actual: map[string]map[string][]string{
172 "slice0": {"db1": {"sql1"}},
173 },
174 expected: true,
175 },
176 {
177 name: "Normal match",
178 actual: map[string]map[string][]string{
179 "slice1": {"db3": {"sql1"}},
180 },
181 expected: true,
182 },
183 {
184 name: "Normal match",
185 actual: map[string]map[string][]string{
186 "slice1": {"db2": {"sql2", "sql1"}},

Callers

nothing calls this directly

Calls 3

checkRandomSQLsFunction · 0.85
ErrorfMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected