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

Function TestParseFilename

tempodb/encoding/vparquet5/wal_block_test.go:136–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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