Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
sandbox/virtcontainers: Fix test fail cause by memory hotplug.
Browse files Browse the repository at this point in the history
Signed-off-by: Clare Chen <[email protected]>
Signed-off-by: Zichang Lin <[email protected]>
  • Loading branch information
linzichang committed Oct 11, 2018
1 parent 6845e8e commit 5a0c73b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cli/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ func TestCreateSandboxConfigFail(t *testing.T) {

_, err = createSandbox(context.Background(), spec, runtimeConfig, testContainerID, bundlePath, testConsole, true, true)
assert.Error(err)
assert.False(vcmock.IsMockError(err))
assert.True(vcmock.IsMockError(err))
}

func TestCreateCreateSandboxFail(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions virtcontainers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,10 @@ func (c *Container) update(resources specs.LinuxResources) error {
return err
}

if err := c.storeContainer(); err != nil {
return err
}

return c.sandbox.agent.updateContainer(c.sandbox, *c, resources)
}

Expand Down Expand Up @@ -1353,11 +1357,8 @@ func (c *Container) updateResources(oldResources, newResources ContainerResource
if err := c.updateVCPUResources(oldResources, &newResources); err != nil {
return err
}
// Set and save container's config VCPUs field only
// Set container's config VCPUs field only
c.config.Resources.VCPUs = newResources.VCPUs
if err := c.storeContainer(); err != nil {
return err
}
}

// Memory is not updated if memory limit not set
Expand All @@ -1366,9 +1367,8 @@ func (c *Container) updateResources(oldResources, newResources ContainerResource
return err
}

// Set and save container's config Mem field only
// Set container's config MemByte field only
c.config.Resources.MemByte = newResources.MemByte
return c.storeContainer()
}

return nil
Expand Down

0 comments on commit 5a0c73b

Please sign in to comment.