MCPcopy
hub / github.com/grafana/tempo / TestParseFilename

Function TestParseFilename

tempodb/encoding/vparquet3/wal_block_test.go:137–220  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestParseFilename(t *testing.T) {
138 tests := []struct {
139 name string
140 filename string
141 expectUUID uuid.UUID
142 expectTenant string
143 expectedVersion string
144 expectError bool
145 }{
146 {
147 name: "happy path",
148 filename: "123e4567-e89b-12d3-a456-426614174000+tenant+vParquet3",
149 expectUUID: uuid.MustParse("123e4567-e89b-12d3-a456-426614174000"),
150 expectTenant: "tenant",
151 expectedVersion: "vParquet3",
152 },
153 {
154 name: "path fails",
155 filename: "/blerg/123e4567-e89b-12d3-a456-426614174000+tenant+vParquet3",
156 expectError: true,
157 },
158 {
159 name: "no +",
160 filename: "123e4567-e89b-12d3-a456-426614174000",
161 expectError: true,
162 },
163 {
164 name: "empty string",
165 filename: "",
166 expectError: true,
167 },
168 {
169 name: "bad uuid",
170 filename: "123e4+tenant+vParquet",
171 expectError: true,
172 },
173 {
174 name: "no tenant",
175 filename: "123e4567-e89b-12d3-a456-426614174000++vParquet3",
176 expectError: true,
177 },
178 {
179 name: "no version",
180 filename: "123e4567-e89b-12d3-a456-426614174000+tenant+",
181 expectError: true,
182 },
183 {
184 name: "wrong version",
185 filename: "123e4567-e89b-12d3-a456-426614174000+tenant+v2",
186 expectError: true,
187 },
188 {
189 name: "wrong splits - 4",
190 filename: "123e4567-e89b-12d3-a456-426614174000+test+test+test",
191 expectError: true,
192 },
193 {
194 name: "wrong splits - 2",

Callers

nothing calls this directly

Calls 4

parseNameFunction · 0.70
ErrorMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected