Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/lib/container_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ func (c *ContainerServer) LoadSandbox(ctx context.Context, id string) (sb *sandb
return sb, err
}

// We should restore the infraContainer to the container state store
c.AddInfraContainer(ctx, scontainer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it feasible to add test coverage for this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sohankunkerkar, I was wondering about this.

This seems like an obvious thing to do. So I wonder why we didn't in the past? Perhaps indeed a bug.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obvious thing to do, as in, load infra containers on restart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it feasible to add test coverage for this change?

can we add a unit test to check if the infraContainer is loaded? like this:
https://github.com/cri-o/cri-o/pull/7726/files#diff-5df3a97ff31edf6084a160b044038d23d5ef6d2ab76f5ad0e5b57d059c37bdbcR160


sb.RestoreStopped()
// We add an NS only if we can load a permanent one.
// Otherwise, the sandbox will live in the host namespace.
Expand Down
13 changes: 13 additions & 0 deletions internal/lib/container_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ var _ = t.Describe("ContainerServer", func() {
Expect(err).To(BeNil())
})

It("should succeed load infraContainer", func() {
// Given
createDummyState()
mockDirs(testManifest)

// When
_, err := sut.LoadSandbox(context.Background(), "id")

// Then
Expect(err).To(BeNil())
Expect(sut.GetInfraContainer(context.Background(), sandboxID)).NotTo(BeNil())
})

It("should succeed with invalid network namespace", func() {
// Given
createDummyState()
Expand Down