nolint:revive // It's a control flag, but this is just a test.
(t *testing.T, path string, wantWorkspace bool, wantAgent bool, badValues []string)
| 252 | |
| 253 | // nolint:revive // It's a control flag, but this is just a test. |
| 254 | func assertBundleContents(t *testing.T, path string, wantWorkspace bool, wantAgent bool, badValues []string) { |
| 255 | t.Helper() |
| 256 | r, err := zip.OpenReader(path) |
| 257 | require.NoError(t, err, "open zip file") |
| 258 | defer r.Close() |
| 259 | for _, f := range r.File { |
| 260 | assertDoesNotContain(t, f, badValues...) |
| 261 | switch f.Name { |
| 262 | case "deployment/buildinfo.json": |
| 263 | var v codersdk.BuildInfoResponse |
| 264 | decodeJSONFromZip(t, f, &v) |
| 265 | require.NotEmpty(t, v, "deployment build info should not be empty") |
| 266 | case "deployment/config.json": |
| 267 | var v codersdk.DeploymentConfig |
| 268 | decodeJSONFromZip(t, f, &v) |
| 269 | require.NotEmpty(t, v, "deployment config should not be empty") |
| 270 | case "deployment/entitlements.json": |
| 271 | var v codersdk.Entitlements |
| 272 | decodeJSONFromZip(t, f, &v) |
| 273 | require.NotNil(t, v, "entitlements should not be nil") |
| 274 | case "deployment/experiments.json": |
| 275 | var v codersdk.Experiments |
| 276 | decodeJSONFromZip(t, f, &v) |
| 277 | require.NotEmpty(t, f, v, "experiments should not be empty") |
| 278 | case "deployment/health.json": |
| 279 | var v healthsdk.HealthcheckReport |
| 280 | decodeJSONFromZip(t, f, &v) |
| 281 | require.NotEmpty(t, v, "health report should not be empty") |
| 282 | case "deployment/health_settings.json": |
| 283 | var v healthsdk.HealthSettings |
| 284 | decodeJSONFromZip(t, f, &v) |
| 285 | require.NotEmpty(t, v, "health settings should not be empty") |
| 286 | case "deployment/stats.json": |
| 287 | var v codersdk.DeploymentStats |
| 288 | decodeJSONFromZip(t, f, &v) |
| 289 | require.NotNil(t, v, "deployment stats should not be nil") |
| 290 | case "deployment/workspaces.json": |
| 291 | var v codersdk.Workspace |
| 292 | decodeJSONFromZip(t, f, &v) |
| 293 | require.NotNil(t, v, "deployment workspaces should not be nil") |
| 294 | case "deployment/prometheus.txt": |
| 295 | bs := readBytesFromZip(t, f) |
| 296 | require.NotEmpty(t, bs, "prometheus metrics should not be empty") |
| 297 | require.Contains(t, string(bs), "go_goroutines", "prometheus metrics should contain go runtime metrics") |
| 298 | case "network/connection_info.json": |
| 299 | var v workspacesdk.AgentConnectionInfo |
| 300 | decodeJSONFromZip(t, f, &v) |
| 301 | require.NotEmpty(t, v, "agent connection info should not be empty") |
| 302 | case "network/coordinator_debug.html": |
| 303 | bs := readBytesFromZip(t, f) |
| 304 | require.NotEmpty(t, bs, "coordinator debug should not be empty") |
| 305 | case "network/tailnet_debug.html": |
| 306 | bs := readBytesFromZip(t, f) |
| 307 | require.NotEmpty(t, bs, "tailnet debug should not be empty") |
| 308 | case "network/netcheck.json": |
| 309 | var v derphealth.Report |
| 310 | decodeJSONFromZip(t, f, &v) |
| 311 | require.NotEmpty(t, v, "netcheck should not be empty") |
no test coverage detected