MCPcopy Index your code
hub / github.com/cli/cli / TestGetZipLogMap

Function TestGetZipLogMap

pkg/cmd/run/view/logs_test.go:135–505  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

133}
134
135func TestGetZipLogMap(t *testing.T) {
136 tests := []struct {
137 name string
138 job shared.Job
139 zipReader *zip.Reader
140 // wantJobLog can be nil (i.e. not found) or string
141 wantJobLog any
142 // wantStepLogs elements can be nil (i.e. not found) or string
143 wantStepLogs []any
144 }{
145 {
146 name: "job log missing from zip, but step log present",
147 job: shared.Job{
148 ID: 123,
149 Name: "job foo",
150 Steps: []shared.Step{{
151 Name: "step one",
152 Number: 1,
153 }},
154 },
155 zipReader: createZipReader(t, map[string]string{
156 "job foo/1_step one.txt": "step one log",
157 }),
158 wantJobLog: nil,
159 wantStepLogs: []any{
160 "step one log",
161 },
162 },
163 {
164 name: "matching job name and step number 1",
165 job: shared.Job{
166 ID: 123,
167 Name: "job foo",
168 Steps: []shared.Step{{
169 Name: "step one",
170 Number: 1,
171 }},
172 },
173 zipReader: createZipReader(t, map[string]string{
174 "0_job foo.txt": "job log",
175 "job foo/1_step one.txt": "step one log",
176 }),
177 wantJobLog: "job log",
178 wantStepLogs: []any{
179 "step one log",
180 },
181 },
182 {
183 name: "matching job name and step number 2",
184 job: shared.Job{
185 ID: 123,
186 Name: "job foo",
187 Steps: []shared.Step{{
188 Name: "step two",
189 Number: 2,
190 }},
191 },
192 zipReader: createZipReader(t, map[string]string{

Callers

nothing calls this directly

Calls 7

createZipReaderFunction · 0.85
getZipLogMapFunction · 0.85
readZipFileFunction · 0.85
forJobMethod · 0.80
EqualMethod · 0.80
forStepMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected