Skip to content

Commit

Permalink
Merge pull request kubevirt#7509 from dankenigsberg/another-tempdir
Browse files Browse the repository at this point in the history
ephemeral-disk_test: shorten with GinkgoT.TempDir()
  • Loading branch information
kubevirt-bot authored Apr 5, 2022
2 parents 93b2f7a + b0f584f commit d578c2e
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions pkg/ephemeral-disk/ephemeral-disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package ephemeraldisk

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"

Expand All @@ -37,7 +36,6 @@ import (

var _ = Describe("ContainerDisk", func() {
var imageTempDirPath string
var backingTempDirPath string
var pvcBaseTempDirPath string
var blockDevBaseDir string
var creator *ephemeralDiskCreator
Expand Down Expand Up @@ -80,19 +78,9 @@ var _ = Describe("ContainerDisk", func() {
}

BeforeEach(func() {
var err error

backingTempDirPath, err = ioutil.TempDir("", "ephemeraldisk-backing")
Expect(err).NotTo(HaveOccurred())

imageTempDirPath, err = ioutil.TempDir("", "ephemeraldisk-image")
Expect(err).NotTo(HaveOccurred())

pvcBaseTempDirPath, err = ioutil.TempDir("", "pvc-base-dir-path")
Expect(err).NotTo(HaveOccurred())

blockDevBaseDir, err = ioutil.TempDir("", "block-dev-base-dir-path")
Expect(err).NotTo(HaveOccurred())
imageTempDirPath = GinkgoT().TempDir()
pvcBaseTempDirPath = GinkgoT().TempDir()
blockDevBaseDir = GinkgoT().TempDir()

creator = &ephemeralDiskCreator{
mountBaseDir: imageTempDirPath,
Expand All @@ -102,12 +90,6 @@ var _ = Describe("ContainerDisk", func() {
}
})

AfterEach(func() {
os.RemoveAll(imageTempDirPath)
os.RemoveAll(backingTempDirPath)
os.RemoveAll(pvcBaseTempDirPath)
})

Describe("ephemeral-backed PVC", func() {
Context("With single ephemeral volume", func() {
It("Should create VirtualMachineInstance's ephemeral image", func() {
Expand Down

0 comments on commit d578c2e

Please sign in to comment.