tests: Refactors PodSandbox creation
Most of the tests creating and using Pod Sandboxes in the same way. We can create a common function that will do that for us, so we can have less duplicated code, and make it easier to add new tests in the future. Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
This commit is contained in:
@@ -41,13 +41,7 @@ func checkMemoryLimit(t *testing.T, spec *runtimespec.Spec, memLimit int64) {
|
||||
func TestUpdateContainerResources(t *testing.T) {
|
||||
// TODO(claudiub): Make this test work once https://github.com/microsoft/hcsshim/pull/931 merges.
|
||||
t.Log("Create a sandbox")
|
||||
sbConfig := PodSandboxConfig("sandbox", "update-container-resources")
|
||||
sb, err := runtimeService.RunPodSandbox(sbConfig, *runtimeHandler)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
assert.NoError(t, runtimeService.StopPodSandbox(sb))
|
||||
assert.NoError(t, runtimeService.RemovePodSandbox(sb))
|
||||
}()
|
||||
sb, sbConfig := PodSandboxConfigWithCleanup(t, "sandbox", "update-container-resources")
|
||||
|
||||
EnsureImageExists(t, pauseImage)
|
||||
|
||||
|
Reference in New Issue
Block a user