fix: container names always null (#1335)

This commit is contained in:
Eli Bosley
2025-04-08 08:56:11 -04:00
committed by GitHub
parent 23c60dad0c
commit 8a5b23856c
2 changed files with 15 additions and 0 deletions

View File

@@ -124,6 +124,7 @@ describe('DockerService', () => {
image: 'test-image',
imageId: 'test-image-id',
ports: [],
sizeRootFs: undefined,
state: ContainerState.EXITED,
status: 'Exited',
labels: {},
@@ -132,6 +133,7 @@ describe('DockerService', () => {
},
networkSettings: {},
mounts: [],
names: ['/test-container'],
},
]);
@@ -175,6 +177,7 @@ describe('DockerService', () => {
image: 'test-image',
imageId: 'test-image-id',
ports: [],
sizeRootFs: undefined,
state: ContainerState.RUNNING,
status: 'Up 2 hours',
labels: {},
@@ -183,6 +186,7 @@ describe('DockerService', () => {
},
networkSettings: {},
mounts: [],
names: ['/test-container'],
});
expect(mockContainer.start).toHaveBeenCalled();
@@ -226,6 +230,7 @@ describe('DockerService', () => {
image: 'test-image',
imageId: 'test-image-id',
ports: [],
sizeRootFs: undefined,
state: ContainerState.EXITED,
status: 'Exited',
labels: {},
@@ -234,6 +239,7 @@ describe('DockerService', () => {
},
networkSettings: {},
mounts: [],
names: ['/test-container'],
});
expect(mockContainer.stop).toHaveBeenCalledWith({ t: 10 });
@@ -376,6 +382,8 @@ describe('DockerService', () => {
image: 'test-image',
imageId: 'test-image-id',
ports: [],
sizeRootFs: undefined,
names: ['/test-container'],
state: ContainerState.RUNNING,
status: 'Up 2 hours',
labels: {},
@@ -393,6 +401,8 @@ describe('DockerService', () => {
image: 'test-image2',
imageId: 'test-image-id2',
ports: [],
sizeRootFs: undefined,
names: ['/test-container2'],
state: ContainerState.EXITED,
status: 'Exited',
labels: {},
@@ -421,6 +431,8 @@ describe('DockerService', () => {
image: 'test-image',
imageId: 'test-image-id',
ports: [],
sizeRootFs: undefined,
names: ['/test-container'],
state: ContainerState.RUNNING,
status: 'Up 2 hours',
labels: {},
@@ -438,6 +450,8 @@ describe('DockerService', () => {
image: 'test-image2',
imageId: 'test-image-id2',
ports: [],
sizeRootFs: undefined,
names: ['/test-container2'],
state: ContainerState.EXITED,
status: 'Exited',
labels: {},

View File

@@ -79,6 +79,7 @@ export class DockerService implements OnModuleInit {
public transformContainer(container: Docker.ContainerInfo): DockerContainer {
return camelCaseKeys<DockerContainer>(
{
names: container.Names,
labels: container.Labels ?? {},
sizeRootFs: undefined,
imageId: container.ImageID,