TestConvertDockerInspect tests the convertDockerInspect function using fixtures from ./testdata.
(t *testing.T)
| 157 | // TestConvertDockerInspect tests the convertDockerInspect function using |
| 158 | // fixtures from ./testdata. |
| 159 | func TestConvertDockerInspect(t *testing.T) { |
| 160 | t.Parallel() |
| 161 | |
| 162 | for _, tt := range []struct { |
| 163 | name string |
| 164 | expect []codersdk.WorkspaceAgentContainer |
| 165 | expectWarns []string |
| 166 | expectError string |
| 167 | }{ |
| 168 | { |
| 169 | name: "container_simple", |
| 170 | expect: []codersdk.WorkspaceAgentContainer{ |
| 171 | { |
| 172 | CreatedAt: time.Date(2025, 3, 11, 17, 55, 58, 91280203, time.UTC), |
| 173 | ID: "6b539b8c60f5230b8b0fde2502cd2332d31c0d526a3e6eb6eef1cc39439b3286", |
| 174 | FriendlyName: "eloquent_kowalevski", |
| 175 | Image: "debian:bookworm", |
| 176 | Labels: map[string]string{}, |
| 177 | Running: true, |
| 178 | Status: "running", |
| 179 | Ports: []codersdk.WorkspaceAgentContainerPort{}, |
| 180 | Volumes: map[string]string{}, |
| 181 | }, |
| 182 | }, |
| 183 | }, |
| 184 | { |
| 185 | name: "container_labels", |
| 186 | expect: []codersdk.WorkspaceAgentContainer{ |
| 187 | { |
| 188 | CreatedAt: time.Date(2025, 3, 11, 20, 3, 28, 71706536, time.UTC), |
| 189 | ID: "bd8818e670230fc6f36145b21cf8d6d35580355662aa4d9fe5ae1b188a4c905f", |
| 190 | FriendlyName: "fervent_bardeen", |
| 191 | Image: "debian:bookworm", |
| 192 | Labels: map[string]string{"baz": "zap", "foo": "bar"}, |
| 193 | Running: true, |
| 194 | Status: "running", |
| 195 | Ports: []codersdk.WorkspaceAgentContainerPort{}, |
| 196 | Volumes: map[string]string{}, |
| 197 | }, |
| 198 | }, |
| 199 | }, |
| 200 | { |
| 201 | name: "container_binds", |
| 202 | expect: []codersdk.WorkspaceAgentContainer{ |
| 203 | { |
| 204 | CreatedAt: time.Date(2025, 3, 11, 17, 58, 43, 522505027, time.UTC), |
| 205 | ID: "fdc75ebefdc0243c0fce959e7685931691ac7aede278664a0e2c23af8a1e8d6a", |
| 206 | FriendlyName: "silly_beaver", |
| 207 | Image: "debian:bookworm", |
| 208 | Labels: map[string]string{}, |
| 209 | Running: true, |
| 210 | Status: "running", |
| 211 | Ports: []codersdk.WorkspaceAgentContainerPort{}, |
| 212 | Volumes: map[string]string{ |
| 213 | "/tmp/test/a": "/var/coder/a", |
| 214 | "/tmp/test/b": "/var/coder/b", |
| 215 | }, |
| 216 | }, |