MCPcopy
hub / github.com/kopia/kopia / TestStatusCode

Function TestStatusCode

notification/notifydata/multi_snapshot_status_test.go:137–199  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestStatusCode(t *testing.T) {
138 tests := []struct {
139 name string
140 manifest notifydata.ManifestWithError
141 expected string
142 }{
143 {
144 name: "fatal error",
145 manifest: notifydata.ManifestWithError{
146 Error: "fatal error",
147 },
148 expected: notifydata.StatusCodeFatal,
149 },
150 {
151 name: "incomplete snapshot",
152 manifest: notifydata.ManifestWithError{
153 Manifest: snapshot.Manifest{
154 IncompleteReason: "incomplete",
155 },
156 },
157 expected: notifydata.StatusCodeIncomplete,
158 },
159 {
160 name: "fatal error in dir summary",
161 manifest: notifydata.ManifestWithError{
162 Manifest: snapshot.Manifest{
163 RootEntry: &snapshot.DirEntry{
164 DirSummary: &fs.DirectorySummary{
165 FatalErrorCount: 1,
166 },
167 },
168 },
169 },
170 expected: notifydata.StatusCodeFatal,
171 },
172 {
173 name: "ignored error in dir summary",
174 manifest: notifydata.ManifestWithError{
175 Manifest: snapshot.Manifest{
176 RootEntry: &snapshot.DirEntry{
177 DirSummary: &fs.DirectorySummary{
178 IgnoredErrorCount: 1,
179 },
180 },
181 },
182 },
183 expected: notifydata.StatusCodeWarnings,
184 },
185 {
186 name: "success",
187 manifest: notifydata.ManifestWithError{
188 Manifest: snapshot.Manifest{},
189 },
190 expected: notifydata.StatusCodeSuccess,
191 },
192 }
193
194 for _, tt := range tests {

Callers

nothing calls this directly

Calls 3

EqualMethod · 0.80
StatusCodeMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected