(t *testing.T)
| 231 | } |
| 232 | |
| 233 | func TestPrettyPrintInfo(t *testing.T) { |
| 234 | infoWithSwarm := sampleInfoNoSwarm |
| 235 | infoWithSwarm.Swarm = sampleSwarmInfo |
| 236 | |
| 237 | infoWithWarningsLinux := sampleInfoNoSwarm |
| 238 | infoWithWarningsLinux.MemoryLimit = false |
| 239 | infoWithWarningsLinux.SwapLimit = false |
| 240 | infoWithWarningsLinux.OomKillDisable = false |
| 241 | infoWithWarningsLinux.CPUCfsQuota = false |
| 242 | infoWithWarningsLinux.CPUCfsPeriod = false |
| 243 | infoWithWarningsLinux.CPUShares = false |
| 244 | infoWithWarningsLinux.CPUSet = false |
| 245 | infoWithWarningsLinux.IPv4Forwarding = false |
| 246 | |
| 247 | sampleInfoDaemonWarnings := sampleInfoNoSwarm |
| 248 | sampleInfoDaemonWarnings.Warnings = []string{ |
| 249 | "WARNING: No memory limit support", |
| 250 | "WARNING: No swap limit support", |
| 251 | "WARNING: No oom kill disable support", |
| 252 | "WARNING: No cpu cfs quota support", |
| 253 | "WARNING: No cpu cfs period support", |
| 254 | "WARNING: No cpu shares support", |
| 255 | "WARNING: No cpuset support", |
| 256 | "WARNING: IPv4 forwarding is disabled", |
| 257 | } |
| 258 | |
| 259 | sampleInfoBadSecurity := sampleInfoNoSwarm |
| 260 | sampleInfoBadSecurity.SecurityOptions = []string{"foo="} |
| 261 | |
| 262 | sampleInfoLabelsNil := sampleInfoNoSwarm |
| 263 | sampleInfoLabelsNil.Labels = nil |
| 264 | sampleInfoLabelsEmpty := sampleInfoNoSwarm |
| 265 | sampleInfoLabelsEmpty.Labels = []string{} |
| 266 | |
| 267 | sampleInfoWithDevices := sampleInfoNoSwarm |
| 268 | sampleInfoWithDevices.DiscoveredDevices = []system.DeviceInfo{ |
| 269 | {Source: "cdi", ID: "com.example.device1"}, |
| 270 | {Source: "cdi", ID: "nvidia.com/gpu=gpu0"}, |
| 271 | } |
| 272 | |
| 273 | for _, tc := range []struct { |
| 274 | doc string |
| 275 | dockerInfo dockerInfo |
| 276 | |
| 277 | prettyGolden string |
| 278 | warningsGolden string |
| 279 | jsonGolden string |
| 280 | expectedError string |
| 281 | }{ |
| 282 | { |
| 283 | doc: "info without swarm", |
| 284 | dockerInfo: dockerInfo{ |
| 285 | Info: &sampleInfoNoSwarm, |
| 286 | ClientInfo: &clientInfo{ |
| 287 | clientVersion: clientVersion{ |
| 288 | Platform: &platformInfo{Name: "Docker Engine - Community"}, |
| 289 | Version: "24.0.0", |
| 290 | Context: "default", |
nothing calls this directly
no test coverage detected
searching dependent graphs…