mirror of
https://github.com/containers/podman.git
synced 2026-03-06 16:00:34 -05:00
Replace deprecated ioutil
Package `io/ioutil` was deprecated in golang 1.16, preventing podman from building under Fedora 37. Fortunately, functionality identical replacements are provided by the packages `io` and `os`. Replace all usage of all `io/ioutil` symbols with appropriate substitutions according to the golang docs. Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
@@ -5,7 +5,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
@@ -108,7 +107,7 @@ var _ = Describe("Podman Benchmark Suite", func() {
|
||||
if f.IsDir() {
|
||||
continue
|
||||
}
|
||||
raw, err := ioutil.ReadFile(path.Join(timedir, f.Name()))
|
||||
raw, err := os.ReadFile(path.Join(timedir, f.Name()))
|
||||
if err != nil {
|
||||
Fail(fmt.Sprintf("Error reading timing file: %v", err))
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package integration
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -219,10 +218,10 @@ var _ = Describe("Podman build", func() {
|
||||
}
|
||||
|
||||
fakeFile := filepath.Join(os.TempDir(), "Containerfile")
|
||||
Expect(ioutil.WriteFile(fakeFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(fakeFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(BeNil())
|
||||
|
||||
targetFile := filepath.Join(targetPath, "Containerfile")
|
||||
Expect(ioutil.WriteFile(targetFile, []byte("FROM scratch"), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(targetFile, []byte("FROM scratch"), 0755)).To(BeNil())
|
||||
|
||||
defer func() {
|
||||
Expect(os.RemoveAll(fakeFile)).To(BeNil())
|
||||
@@ -257,7 +256,7 @@ var _ = Describe("Podman build", func() {
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "build/basicalpine", "--iidfile", targetFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
id, _ := ioutil.ReadFile(targetFile)
|
||||
id, _ := os.ReadFile(targetFile)
|
||||
|
||||
// Verify that id is correct
|
||||
inspect := podmanTest.Podman([]string{"inspect", string(id)})
|
||||
@@ -311,7 +310,7 @@ var _ = Describe("Podman build", func() {
|
||||
RUN printenv http_proxy`, ALPINE)
|
||||
|
||||
dockerfilePath := filepath.Join(podmanTest.TempDir, "Dockerfile")
|
||||
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir})
|
||||
session.Wait(120)
|
||||
@@ -330,7 +329,7 @@ RUN printenv http_proxy`, ALPINE)
|
||||
RUN exit 5`, ALPINE)
|
||||
|
||||
dockerfilePath := filepath.Join(podmanTest.TempDir, "Dockerfile")
|
||||
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "-t", "error-test", "--file", dockerfilePath, podmanTest.TempDir})
|
||||
session.Wait(120)
|
||||
@@ -388,7 +387,7 @@ RUN exit 5`, ALPINE)
|
||||
err = os.Mkdir(targetSubPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
dummyFile := filepath.Join(targetSubPath, "dummy")
|
||||
err = ioutil.WriteFile(dummyFile, []byte("dummy"), 0644)
|
||||
err = os.WriteFile(dummyFile, []byte("dummy"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
@@ -396,7 +395,7 @@ ADD . /test
|
||||
RUN find /test`, ALPINE)
|
||||
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
defer func() {
|
||||
@@ -437,7 +436,7 @@ RUN find /test`, ALPINE)
|
||||
containerfile := fmt.Sprintf("FROM %s", ALPINE)
|
||||
|
||||
containerfilePath := filepath.Join(targetSubPath, "Containerfile")
|
||||
err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
defer func() {
|
||||
@@ -476,7 +475,7 @@ ADD . /testfilter/
|
||||
RUN find /testfilter/`, ALPINE)
|
||||
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||
@@ -484,15 +483,15 @@ RUN find /testfilter/`, ALPINE)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
dummyFile1 := filepath.Join(targetPath, "dummy1")
|
||||
err = ioutil.WriteFile(dummyFile1, []byte("dummy1"), 0644)
|
||||
err = os.WriteFile(dummyFile1, []byte("dummy1"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
dummyFile2 := filepath.Join(targetPath, "dummy2")
|
||||
err = ioutil.WriteFile(dummyFile2, []byte("dummy2"), 0644)
|
||||
err = os.WriteFile(dummyFile2, []byte("dummy2"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
dummyFile3 := filepath.Join(targetSubPath, "dummy3")
|
||||
err = ioutil.WriteFile(dummyFile3, []byte("dummy3"), 0644)
|
||||
err = os.WriteFile(dummyFile3, []byte("dummy3"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
defer func() {
|
||||
@@ -509,7 +508,7 @@ subdir**`
|
||||
|
||||
// test .dockerignore
|
||||
By("Test .dockererignore")
|
||||
err = ioutil.WriteFile(dockerignoreFile, []byte(dockerignoreContent), 0644)
|
||||
err = os.WriteFile(dockerignoreFile, []byte(dockerignoreContent), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "-t", "test", "."})
|
||||
@@ -540,18 +539,18 @@ subdir**`
|
||||
contents.WriteString("RUN find /testfilter/ -print\n")
|
||||
|
||||
containerfile := filepath.Join(tempdir, "Containerfile")
|
||||
Expect(ioutil.WriteFile(containerfile, contents.Bytes(), 0644)).ToNot(HaveOccurred())
|
||||
Expect(os.WriteFile(containerfile, contents.Bytes(), 0644)).ToNot(HaveOccurred())
|
||||
|
||||
contextDir, err := CreateTempDirInTempDir()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
defer os.RemoveAll(contextDir)
|
||||
|
||||
Expect(ioutil.WriteFile(filepath.Join(contextDir, "expected"), contents.Bytes(), 0644)).
|
||||
Expect(os.WriteFile(filepath.Join(contextDir, "expected"), contents.Bytes(), 0644)).
|
||||
ToNot(HaveOccurred())
|
||||
|
||||
subdirPath := filepath.Join(contextDir, "subdir")
|
||||
Expect(os.MkdirAll(subdirPath, 0755)).ToNot(HaveOccurred())
|
||||
Expect(ioutil.WriteFile(filepath.Join(subdirPath, "extra"), contents.Bytes(), 0644)).
|
||||
Expect(os.WriteFile(filepath.Join(subdirPath, "extra"), contents.Bytes(), 0644)).
|
||||
ToNot(HaveOccurred())
|
||||
randomFile := filepath.Join(subdirPath, "randomFile")
|
||||
dd := exec.Command("dd", "if=/dev/urandom", "of="+randomFile, "bs=1G", "count=1")
|
||||
@@ -567,7 +566,7 @@ subdir**`
|
||||
}()
|
||||
|
||||
By("Test .containerignore filtering subdirectory")
|
||||
err = ioutil.WriteFile(filepath.Join(contextDir, ".containerignore"), []byte(`subdir/`), 0644)
|
||||
err = os.WriteFile(filepath.Join(contextDir, ".containerignore"), []byte(`subdir/`), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "-f", containerfile, contextDir})
|
||||
@@ -597,7 +596,7 @@ subdir**`
|
||||
err = os.Mkdir(targetSubPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
dummyFile := filepath.Join(targetSubPath, "dummy")
|
||||
err = ioutil.WriteFile(dummyFile, []byte("dummy"), 0644)
|
||||
err = os.WriteFile(dummyFile, []byte("dummy"), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
emptyDir := filepath.Join(targetSubPath, "emptyDir")
|
||||
@@ -612,7 +611,7 @@ RUN find /test
|
||||
RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
|
||||
|
||||
containerfilePath := filepath.Join(targetSubPath, "Containerfile")
|
||||
err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
defer func() {
|
||||
@@ -641,7 +640,7 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
|
||||
RUN cat /etc/hosts
|
||||
RUN grep CapEff /proc/self/status`
|
||||
|
||||
Expect(ioutil.WriteFile(containerFile, []byte(content), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(containerFile, []byte(content), 0755)).To(BeNil())
|
||||
|
||||
defer func() {
|
||||
Expect(os.RemoveAll(containerFile)).To(BeNil())
|
||||
@@ -668,7 +667,7 @@ RUN grep CapEff /proc/self/status`
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||
Expect(ioutil.WriteFile(containerFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(containerFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(BeNil())
|
||||
|
||||
defer func() {
|
||||
Expect(os.RemoveAll(containerFile)).To(BeNil())
|
||||
@@ -712,7 +711,7 @@ RUN grep CapEff /proc/self/status`
|
||||
RUN echo hello`, ALPINE)
|
||||
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--timestamp", "0", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -730,7 +729,7 @@ RUN echo hello`, ALPINE)
|
||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||
content := `FROM scratch`
|
||||
|
||||
Expect(ioutil.WriteFile(containerFile, []byte(content), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(containerFile, []byte(content), 0755)).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"build", "--log-rusage", "--pull-never", targetPath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -743,7 +742,7 @@ RUN echo hello`, ALPINE)
|
||||
It("podman build --arch --os flag", func() {
|
||||
containerfile := `FROM scratch`
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--arch", "foo", "--os", "bar", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -762,7 +761,7 @@ RUN echo hello`, ALPINE)
|
||||
It("podman build --os windows flag", func() {
|
||||
containerfile := `FROM scratch`
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--os", "windows", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -785,7 +784,7 @@ RUN echo hello`, ALPINE)
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
RUN ls /dev/fuse`, ALPINE)
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -801,7 +800,7 @@ RUN ls /dev/fuse`, ALPINE)
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
RUN ls /dev/test1`, ALPINE)
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -822,7 +821,7 @@ RUN ls /dev/test1`, ALPINE)
|
||||
Expect(err).To(BeNil())
|
||||
err = os.Mkdir(buildRoot, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
err = ioutil.WriteFile(containerFilePath, []byte(containerFile), 0755)
|
||||
err = os.WriteFile(containerFilePath, []byte(containerFile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
build := podmanTest.Podman([]string{"build", "-f", containerFilePath, buildRoot})
|
||||
build.WaitWithDefaultTimeout()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -287,7 +286,7 @@ var _ = Describe("Podman commit", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
id, _ := ioutil.ReadFile(targetFile)
|
||||
id, _ := os.ReadFile(targetFile)
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
data := check.InspectImageJSON()
|
||||
@@ -297,7 +296,7 @@ var _ = Describe("Podman commit", func() {
|
||||
It("podman commit should not commit secret", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -322,7 +321,7 @@ var _ = Describe("Podman commit", func() {
|
||||
It("podman commit should not commit env secret", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/url"
|
||||
@@ -144,7 +143,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
|
||||
}
|
||||
f.Close()
|
||||
}
|
||||
path, err := ioutil.TempDir("", "libpodlock")
|
||||
path, err := os.MkdirTemp("", "libpodlock")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
@@ -875,7 +874,7 @@ func writeConf(conf []byte, confPath string) {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
if err := ioutil.WriteFile(confPath, conf, 0o777); err != nil {
|
||||
if err := os.WriteFile(confPath, conf, 0o777); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
@@ -967,7 +966,7 @@ func (s *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
|
||||
|
||||
func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers string, label string) string {
|
||||
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile")
|
||||
err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
cmd := []string{"build", "--pull-never", "--layers=" + layers, "--file", dockerfilePath}
|
||||
if label != "" {
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
func buildDataVolumeImage(pTest *PodmanTestIntegration, image, data, dest string) {
|
||||
// Create a dummy file for data volume
|
||||
dummyFile := filepath.Join(pTest.TempDir, data)
|
||||
err := ioutil.WriteFile(dummyFile, []byte(data), 0644)
|
||||
err := os.WriteFile(dummyFile, []byte(data), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// Create a data volume container image but no CMD binary in it
|
||||
@@ -29,7 +28,7 @@ VOLUME %s/`, data, dest, dest)
|
||||
func createContainersConfFile(pTest *PodmanTestIntegration) {
|
||||
configPath := filepath.Join(pTest.TempDir, "containers.conf")
|
||||
containersConf := []byte("[containers]\nprepare_volume_on_create = true\n")
|
||||
err := ioutil.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
err := os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// Set custom containers.conf file
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -208,7 +207,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
tempdir, err = CreateTempDirInTempDir()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err := ioutil.WriteFile(conffile, []byte(fmt.Sprintf("[containers]\nvolumes=[\"%s:%s:Z\",]\n", tempdir, tempdir)), 0755)
|
||||
err := os.WriteFile(conffile, []byte(fmt.Sprintf("[containers]\nvolumes=[\"%s:%s:Z\",]\n", tempdir, tempdir)), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
os.Setenv("CONTAINERS_CONF", conffile)
|
||||
@@ -406,7 +405,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
|
||||
profile := filepath.Join(podmanTest.TempDir, "seccomp.json")
|
||||
containersConf := []byte(fmt.Sprintf("[containers]\nseccomp_profile=\"%s\"", profile))
|
||||
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
err = os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if IsRemote() {
|
||||
@@ -430,7 +429,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
os.Setenv("CONTAINERS_CONF", configPath)
|
||||
|
||||
containersConf := []byte("[engine]\nimage_copy_tmp_dir=\"/foobar\"")
|
||||
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
err = os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if IsRemote() {
|
||||
@@ -443,7 +442,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
Expect(session.OutputToString()).To(Equal("/foobar"))
|
||||
|
||||
containersConf = []byte(fmt.Sprintf("[engine]\nimage_copy_tmp_dir=%q", storagePath))
|
||||
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
err = os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
if IsRemote() {
|
||||
podmanTest.RestartRemoteService()
|
||||
@@ -455,7 +454,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
Expect(session.Out.Contents()).To(ContainSubstring(storagePath))
|
||||
|
||||
containersConf = []byte("[engine]\nimage_copy_tmp_dir=\"storage1\"")
|
||||
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
err = os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if !IsRemote() {
|
||||
@@ -485,7 +484,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
os.Setenv("CONTAINERS_CONF", configPath)
|
||||
|
||||
containersConf := []byte("[engine]\ninfra_image=\"" + infra1 + "\"")
|
||||
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
err = os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if IsRemote() {
|
||||
@@ -520,7 +519,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
os.Setenv("CONTAINERS_CONF", configPath)
|
||||
defer os.Remove(configPath)
|
||||
|
||||
err := ioutil.WriteFile(configPath, []byte("[engine]\nremote=true"), os.ModePerm)
|
||||
err := os.WriteFile(configPath, []byte("[engine]\nremote=true"), os.ModePerm)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// podmanTest.Podman() cannot be used as it was initialized remote==false
|
||||
@@ -540,7 +539,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
}
|
||||
|
||||
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
|
||||
err := ioutil.WriteFile(conffile, []byte("[containers]\ncgroups=\"disabled\"\n"), 0755)
|
||||
err := os.WriteFile(conffile, []byte("[containers]\ncgroups=\"disabled\"\n"), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
result := podmanTest.Podman([]string{"create", ALPINE, "true"})
|
||||
@@ -572,7 +571,7 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
It("podman containers.conf runtime", func() {
|
||||
SkipIfRemote("--runtime option is not available for remote commands")
|
||||
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
|
||||
err := ioutil.WriteFile(conffile, []byte("[engine]\nruntime=\"testruntime\"\n"), 0755)
|
||||
err := os.WriteFile(conffile, []byte("[engine]\nruntime=\"testruntime\"\n"), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
os.Setenv("CONTAINERS_CONF", conffile)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
@@ -43,13 +42,13 @@ var _ = Describe("Podman cp", func() {
|
||||
// Copy a file to the container, then back to the host and make sure
|
||||
// that the contents match.
|
||||
It("podman cp file", func() {
|
||||
srcFile, err := ioutil.TempFile("", "")
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp file test")
|
||||
err = ioutil.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// Create a container. NOTE that container mustn't be running for copying.
|
||||
@@ -72,7 +71,7 @@ var _ = Describe("Podman cp", func() {
|
||||
|
||||
// Copy FROM the container.
|
||||
|
||||
destFile, err := ioutil.TempFile("", "")
|
||||
destFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer destFile.Close()
|
||||
defer os.Remove(destFile.Name())
|
||||
@@ -86,7 +85,7 @@ var _ = Describe("Podman cp", func() {
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
// Now make sure the content matches.
|
||||
roundtripContent, err := ioutil.ReadFile(destFile.Name())
|
||||
roundtripContent, err := os.ReadFile(destFile.Name())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(roundtripContent).To(Equal(originalContent))
|
||||
})
|
||||
@@ -94,13 +93,13 @@ var _ = Describe("Podman cp", func() {
|
||||
// Copy a file to the container, then back to the host in --pid=host
|
||||
It("podman cp --pid=host file", func() {
|
||||
SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
|
||||
srcFile, err := ioutil.TempFile("", "")
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp file test")
|
||||
err = ioutil.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// Create a container. NOTE that container mustn't be running for copying.
|
||||
@@ -120,7 +119,7 @@ var _ = Describe("Podman cp", func() {
|
||||
|
||||
// Copy FROM the container.
|
||||
|
||||
destFile, err := ioutil.TempFile("", "")
|
||||
destFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer destFile.Close()
|
||||
defer os.Remove(destFile.Name())
|
||||
@@ -130,7 +129,7 @@ var _ = Describe("Podman cp", func() {
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
// Now make sure the content matches.
|
||||
roundtripContent, err := ioutil.ReadFile(destFile.Name())
|
||||
roundtripContent, err := os.ReadFile(destFile.Name())
|
||||
Expect(err).To(BeNil())
|
||||
Expect(roundtripContent).To(Equal(originalContent))
|
||||
})
|
||||
@@ -139,13 +138,13 @@ var _ = Describe("Podman cp", func() {
|
||||
// make sure that the link and the resolved path are accessible and
|
||||
// give the right content.
|
||||
It("podman cp symlink", func() {
|
||||
srcFile, err := ioutil.TempFile("", "")
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp symlink test")
|
||||
err = ioutil.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top"})
|
||||
@@ -178,13 +177,13 @@ var _ = Describe("Podman cp", func() {
|
||||
// the path to the volume's mount point on the host, and 3) copy the
|
||||
// data to the volume and not the container.
|
||||
It("podman cp volume", func() {
|
||||
srcFile, err := ioutil.TempFile("", "")
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
|
||||
originalContent := []byte("podman cp volume")
|
||||
err = ioutil.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
err = os.WriteFile(srcFile.Name(), originalContent, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"volume", "create", "data"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -205,7 +204,7 @@ var _ = Describe("Podman cp", func() {
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
volumeMountPoint := session.OutputToString()
|
||||
copiedContent, err := ioutil.ReadFile(filepath.Join(volumeMountPoint, "file.txt"))
|
||||
copiedContent, err := os.ReadFile(filepath.Join(volumeMountPoint, "file.txt"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(copiedContent).To(Equal(originalContent))
|
||||
})
|
||||
@@ -214,7 +213,7 @@ var _ = Describe("Podman cp", func() {
|
||||
// it to the host and back to the container and make sure that we can
|
||||
// access it, and (roughly) the right users own it.
|
||||
It("podman cp from ctr chown ", func() {
|
||||
srcFile, err := ioutil.TempFile("", "")
|
||||
srcFile, err := os.CreateTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer srcFile.Close()
|
||||
defer os.Remove(srcFile.Name())
|
||||
@@ -265,7 +264,7 @@ var _ = Describe("Podman cp", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session = podmanTest.Podman([]string{"cp", container + ":/", tmpDir})
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -242,7 +241,7 @@ var _ = Describe("Podman create", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(125))
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -545,7 +544,7 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
|
||||
It("podman exec with env var secret", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
@@ -278,7 +277,7 @@ var _ = Describe("Podman generate kube", func() {
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
}
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -752,7 +751,7 @@ var _ = Describe("Podman generate kube", func() {
|
||||
kube.WaitWithDefaultTimeout()
|
||||
Expect(kube).Should(Exit(0))
|
||||
|
||||
b, err := ioutil.ReadFile(outputFile)
|
||||
b, err := os.ReadFile(outputFile)
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
pod := new(v1.Pod)
|
||||
err = yaml.Unmarshal(b, pod)
|
||||
@@ -1045,7 +1044,7 @@ ENTRYPOINT ["sleep"]`
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
image := "generatekube:test"
|
||||
@@ -1135,7 +1134,7 @@ USER test1`
|
||||
targetPath, err := CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
image := "generatekube:test"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -539,7 +538,7 @@ var _ = Describe("Podman generate systemd", func() {
|
||||
})
|
||||
|
||||
It("podman generate systemd pod with containers --new", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@@ -303,7 +302,7 @@ var _ = Describe("Podman healthcheck run", func() {
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
|
||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
||||
err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
defer func() {
|
||||
Expect(os.Chdir(cwd)).To(BeNil())
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -25,7 +24,7 @@ var _ = Describe("podman image scp", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
ConfPath.Value, ConfPath.IsSet = os.LookupEnv("CONTAINERS_CONF")
|
||||
conf, err := ioutil.TempFile("", "containersconf")
|
||||
conf, err := os.CreateTemp("", "containersconf")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
os.Setenv("CONTAINERS_CONF", conf.Name())
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
@@ -104,7 +103,7 @@ var _ = Describe("Podman Info", func() {
|
||||
driver := `"overlay"`
|
||||
storageOpt := `"/usr/bin/fuse-overlayfs"`
|
||||
storageConf := []byte(fmt.Sprintf("[storage]\ndriver=%s\nrootless_storage_path=%s\n[storage.options]\nmount_program=%s", driver, rootlessStoragePath, storageOpt))
|
||||
err = ioutil.WriteFile(configPath, storageConf, os.ModePerm)
|
||||
err = os.WriteFile(configPath, storageConf, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
u, err := user.Current()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
. "github.com/containers/podman/v4/test/utils"
|
||||
@@ -150,7 +149,7 @@ var _ = Describe("Podman kill", func() {
|
||||
})
|
||||
|
||||
It("podman kill --cidfile", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "cid"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
@@ -170,12 +169,12 @@ var _ = Describe("Podman kill", func() {
|
||||
})
|
||||
|
||||
It("podman kill multiple --cidfile", func() {
|
||||
tmpDir1, err := ioutil.TempDir("", "")
|
||||
tmpDir1, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile1 := tmpDir1 + "cid"
|
||||
defer os.RemoveAll(tmpDir1)
|
||||
|
||||
tmpDir2, err := ioutil.TempDir("", "")
|
||||
tmpDir2, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile2 := tmpDir2 + "cid"
|
||||
defer os.RemoveAll(tmpDir2)
|
||||
|
||||
@@ -6,7 +6,6 @@ package integration
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -58,7 +57,7 @@ func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() {
|
||||
func (p *PodmanTestIntegration) setRegistriesConfigEnv(b []byte) {
|
||||
outfile := filepath.Join(p.TempDir, "registries.conf")
|
||||
os.Setenv("CONTAINERS_REGISTRIES_CONF", outfile)
|
||||
err := ioutil.WriteFile(outfile, b, 0644)
|
||||
err := os.WriteFile(outfile, b, 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package integration
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
@@ -101,7 +100,7 @@ var _ = Describe("Podman login and logout", func() {
|
||||
})
|
||||
|
||||
readAuthInfo := func(filePath string) map[string]interface{} {
|
||||
authBytes, err := ioutil.ReadFile(filePath)
|
||||
authBytes, err := os.ReadFile(filePath)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
var authInfo map[string]interface{}
|
||||
@@ -137,12 +136,12 @@ var _ = Describe("Podman login and logout", func() {
|
||||
})
|
||||
|
||||
It("podman login and logout without registry parameter", func() {
|
||||
registriesConf, err := ioutil.TempFile("", "TestLoginWithoutParameter")
|
||||
registriesConf, err := os.CreateTemp("", "TestLoginWithoutParameter")
|
||||
Expect(err).To(BeNil())
|
||||
defer registriesConf.Close()
|
||||
defer os.Remove(registriesConf.Name())
|
||||
|
||||
err = ioutil.WriteFile(registriesConf.Name(), registriesConfWithSearch, os.ModePerm)
|
||||
err = os.WriteFile(registriesConf.Name(), registriesConfWithSearch, os.ModePerm)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// Environment is per-process, so this looks very unsafe; actually it seems fine because tests are not
|
||||
@@ -448,7 +447,7 @@ var _ = Describe("Podman login and logout", func() {
|
||||
It("podman login and logout with repository push with invalid auth.json credentials", func() {
|
||||
authFile := filepath.Join(podmanTest.TempDir, "auth.json")
|
||||
// only `server` contains the correct login data
|
||||
err := ioutil.WriteFile(authFile, []byte(fmt.Sprintf(`{"auths": {
|
||||
err := os.WriteFile(authFile, []byte(fmt.Sprintf(`{"auths": {
|
||||
"%s/podmantest": { "auth": "cG9kbWFudGVzdDp3cm9uZw==" },
|
||||
"%s": { "auth": "cG9kbWFudGVzdDp0ZXN0" }
|
||||
}}`, server, server)), 0644)
|
||||
@@ -494,7 +493,7 @@ var _ = Describe("Podman login and logout", func() {
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
// only `server + /podmantest` and `server` have the correct login data
|
||||
err := ioutil.WriteFile(authFile, []byte(fmt.Sprintf(`{"auths": {
|
||||
err := os.WriteFile(authFile, []byte(fmt.Sprintf(`{"auths": {
|
||||
"%s/podmantest/test-alpine": { "auth": "cG9kbWFudGVzdDp3cm9uZw==" },
|
||||
"%s/podmantest": { "auth": "cG9kbWFudGVzdDp0ZXN0" },
|
||||
"%s": { "auth": "cG9kbWFudGVzdDp0ZXN0" }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -338,7 +337,7 @@ var _ = Describe("Podman manifest", func() {
|
||||
for _, f := range blobs {
|
||||
blobPath := filepath.Join(blobsDir, f.Name())
|
||||
|
||||
sourceFile, err := ioutil.ReadFile(blobPath)
|
||||
sourceFile, err := os.ReadFile(blobPath)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
compressionType := archive.DetectCompression(sourceFile)
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -31,7 +30,7 @@ var _ = Describe("Podman pause", func() {
|
||||
}
|
||||
|
||||
if CGROUPSV2 {
|
||||
b, err := ioutil.ReadFile("/proc/self/cgroup")
|
||||
b, err := os.ReadFile("/proc/self/cgroup")
|
||||
if err != nil {
|
||||
Skip("cannot read self cgroup")
|
||||
}
|
||||
@@ -336,7 +335,7 @@ var _ = Describe("Podman pause", func() {
|
||||
})
|
||||
|
||||
It("podman pause --cidfile", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
@@ -365,7 +364,7 @@ var _ = Describe("Podman pause", func() {
|
||||
})
|
||||
|
||||
It("podman pause multiple --cidfile", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -767,7 +766,7 @@ func generateMultiDocKubeYaml(kubeObjects []string, pathname string) error {
|
||||
|
||||
func createSecret(podmanTest *PodmanTestIntegration, name string, value []byte) { //nolint:unparam
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, value, 0755)
|
||||
err := os.WriteFile(secretFilePath, value, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
secret := podmanTest.Podman([]string{"secret", "create", name, secretFilePath})
|
||||
@@ -1442,7 +1441,7 @@ var _ = Describe("Podman play kube", func() {
|
||||
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
|
||||
|
||||
infraImage := "k8s.gcr.io/pause:3.2"
|
||||
err := ioutil.WriteFile(conffile, []byte(fmt.Sprintf("[engine]\ninfra_image=\"%s\"\n", infraImage)), 0644)
|
||||
err := os.WriteFile(conffile, []byte(fmt.Sprintf("[engine]\ninfra_image=\"%s\"\n", infraImage)), 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
os.Setenv("CONTAINERS_CONF", conffile)
|
||||
@@ -2370,7 +2369,7 @@ spec:
|
||||
tempdir, err = CreateTempDirInTempDir()
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
err := ioutil.WriteFile(conffile, []byte(testyaml), 0755)
|
||||
err := os.WriteFile(conffile, []byte(testyaml), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
kube := podmanTest.Podman([]string{"play", "kube", conffile})
|
||||
@@ -3800,7 +3799,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
}
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -3808,7 +3807,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q
|
||||
Skip("cannot find mappings for the current user")
|
||||
}
|
||||
|
||||
initialUsernsConfig, err := ioutil.ReadFile("/proc/self/uid_map")
|
||||
initialUsernsConfig, err := os.ReadFile("/proc/self/uid_map")
|
||||
Expect(err).To(BeNil())
|
||||
if os.Geteuid() != 0 {
|
||||
unshare := podmanTest.Podman([]string{"unshare", "cat", "/proc/self/uid_map"})
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
@@ -332,7 +331,7 @@ var _ = Describe("Podman pod create", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
id, _ := ioutil.ReadFile(targetFile)
|
||||
id, _ := os.ReadFile(targetFile)
|
||||
check := podmanTest.Podman([]string{"pod", "inspect", "abc"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
data := check.InspectPodToJSON()
|
||||
@@ -707,7 +706,7 @@ ENTRYPOINT ["sleep","99999"]
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -742,7 +741,7 @@ ENTRYPOINT ["sleep","99999"]
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -778,7 +777,7 @@ ENTRYPOINT ["sleep","99999"]
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -815,7 +814,7 @@ ENTRYPOINT ["sleep","99999"]
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package integration
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -235,7 +234,7 @@ var _ = Describe("Podman pod rm", func() {
|
||||
})
|
||||
|
||||
It("podman pod start/remove single pod via --pod-id-file", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
@@ -264,7 +263,7 @@ var _ = Describe("Podman pod rm", func() {
|
||||
})
|
||||
|
||||
It("podman pod start/remove multiple pods via --pod-id-file", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -175,7 +174,7 @@ var _ = Describe("Podman pod start", func() {
|
||||
})
|
||||
|
||||
It("podman pod start single pod via --pod-id-file", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
@@ -199,7 +198,7 @@ var _ = Describe("Podman pod start", func() {
|
||||
})
|
||||
|
||||
It("podman pod start multiple pods via --pod-id-file", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
@@ -231,7 +230,7 @@ var _ = Describe("Podman pod start", func() {
|
||||
})
|
||||
|
||||
It("podman pod create --infra-conmon-pod create + start", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
@@ -248,7 +247,7 @@ var _ = Describe("Podman pod start", func() {
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) // infra
|
||||
|
||||
readFirstLine := func(path string) string {
|
||||
content, err := ioutil.ReadFile(path)
|
||||
content, err := os.ReadFile(path)
|
||||
Expect(err).To(BeNil())
|
||||
return strings.Split(string(content), "\n")[0]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
. "github.com/containers/podman/v4/test/utils"
|
||||
@@ -181,7 +180,7 @@ var _ = Describe("Podman pod stop", func() {
|
||||
})
|
||||
|
||||
It("podman pod start/stop single pod via --pod-id-file", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "podID"
|
||||
defer os.RemoveAll(tmpDir)
|
||||
@@ -210,7 +209,7 @@ var _ = Describe("Podman pod stop", func() {
|
||||
})
|
||||
|
||||
It("podman pod start/stop multiple pods via --pod-id-file", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -84,7 +83,7 @@ var _ = Describe("Podman push", func() {
|
||||
for _, f := range blobs {
|
||||
blobPath := filepath.Join(blobsDir, f.Name())
|
||||
|
||||
sourceFile, err := ioutil.ReadFile(blobPath)
|
||||
sourceFile, err := os.ReadFile(blobPath)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
compressionType := archive.DetectCompression(sourceFile)
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@@ -251,7 +250,7 @@ var _ = Describe("Podman restart", func() {
|
||||
})
|
||||
|
||||
It("podman restart --cidfile", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
@@ -274,7 +273,7 @@ var _ = Describe("Podman restart", func() {
|
||||
})
|
||||
|
||||
It("podman restart multiple --cidfile", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
. "github.com/containers/podman/v4/test/utils"
|
||||
@@ -145,7 +144,7 @@ var _ = Describe("Podman rm", func() {
|
||||
})
|
||||
|
||||
It("podman rm --cidfile", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
@@ -166,7 +165,7 @@ var _ = Describe("Podman rm", func() {
|
||||
})
|
||||
|
||||
It("podman rm multiple --cidfile", func() {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
@@ -5,7 +5,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -104,7 +103,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
|
||||
}
|
||||
`
|
||||
aaFile := filepath.Join(os.TempDir(), "aaFile")
|
||||
Expect(ioutil.WriteFile(aaFile, []byte(aaProfile), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile(aaFile, []byte(aaProfile), 0755)).To(BeNil())
|
||||
parse := SystemExec("apparmor_parser", []string{"-Kr", aaFile})
|
||||
Expect(parse).Should(Exit(0))
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -86,12 +85,12 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
|
||||
containerCgroup := strings.TrimRight(strings.ReplaceAll(exec.OutputToString(), "0::", ""), "\n")
|
||||
|
||||
// Move the container process to a sub cgroup
|
||||
content, err := ioutil.ReadFile(filepath.Join(cgroupRoot, containerCgroup, "cgroup.procs"))
|
||||
content, err := os.ReadFile(filepath.Join(cgroupRoot, containerCgroup, "cgroup.procs"))
|
||||
Expect(err).To(BeNil())
|
||||
oldSubCgroupPath := filepath.Join(cgroupRoot, containerCgroup, "old-container")
|
||||
err = os.MkdirAll(oldSubCgroupPath, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
err = ioutil.WriteFile(filepath.Join(oldSubCgroupPath, "cgroup.procs"), content, 0644)
|
||||
err = os.WriteFile(filepath.Join(oldSubCgroupPath, "cgroup.procs"), content, 0644)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
newCgroup := fmt.Sprintf("%s/new-container", containerCgroup)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
. "github.com/containers/podman/v4/test/utils"
|
||||
@@ -26,7 +25,7 @@ var _ = Describe("Podman run cpu", func() {
|
||||
}
|
||||
|
||||
if CGROUPSV2 {
|
||||
if err := ioutil.WriteFile("/sys/fs/cgroup/cgroup.subtree_control", []byte("+cpuset"), 0644); err != nil {
|
||||
if err := os.WriteFile("/sys/fs/cgroup/cgroup.subtree_control", []byte("+cpuset"), 0644); err != nil {
|
||||
Skip("cpuset controller not available on the current kernel")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -638,7 +637,7 @@ USER bin`, BB)
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(Equal("111"))
|
||||
|
||||
currentOOMScoreAdj, err := ioutil.ReadFile("/proc/self/oom_score_adj")
|
||||
currentOOMScoreAdj, err := os.ReadFile("/proc/self/oom_score_adj")
|
||||
Expect(err).To(BeNil())
|
||||
session = podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "cat", "/proc/self/oom_score_adj"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -845,7 +844,7 @@ USER bin`, BB)
|
||||
"stage" : [ "prestart" ]
|
||||
}
|
||||
`, hookScriptPath)
|
||||
err = ioutil.WriteFile(hookJSONPath, []byte(hookJSON), 0644)
|
||||
err = os.WriteFile(hookJSONPath, []byte(hookJSON), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
random := stringid.GenerateRandomID()
|
||||
@@ -853,14 +852,14 @@ USER bin`, BB)
|
||||
hookScript := fmt.Sprintf(`#!/bin/sh
|
||||
echo -n %s >%s
|
||||
`, random, targetFile)
|
||||
err = ioutil.WriteFile(hookScriptPath, []byte(hookScript), 0755)
|
||||
err = os.WriteFile(hookScriptPath, []byte(hookScript), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session := podmanTest.Podman([]string{"--hooks-dir", hooksDir, "run", ALPINE, "ls"})
|
||||
session.Wait(10)
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
b, err := ioutil.ReadFile(targetFile)
|
||||
b, err := os.ReadFile(targetFile)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(b)).To(Equal(random))
|
||||
})
|
||||
@@ -877,19 +876,19 @@ echo -n %s >%s
|
||||
|
||||
mountsFile := filepath.Join(containersDir, "mounts.conf")
|
||||
mountString := secretsDir + ":/run/secrets"
|
||||
err = ioutil.WriteFile(mountsFile, []byte(mountString), 0755)
|
||||
err = os.WriteFile(mountsFile, []byte(mountString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
secretsFile := filepath.Join(secretsDir, "test.txt")
|
||||
secretsString := "Testing secrets mount. I am mounted!"
|
||||
err = ioutil.WriteFile(secretsFile, []byte(secretsString), 0755)
|
||||
err = os.WriteFile(secretsFile, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
targetDir := tempdir + "/symlink/target"
|
||||
err = os.MkdirAll(targetDir, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
keyFile := filepath.Join(targetDir, "key.pem")
|
||||
err = ioutil.WriteFile(keyFile, []byte(mountString), 0755)
|
||||
err = os.WriteFile(keyFile, []byte(mountString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
execSession := SystemExec("ln", []string{"-s", targetDir, filepath.Join(secretsDir, "mysymlink")})
|
||||
Expect(execSession).Should(Exit(0))
|
||||
@@ -908,7 +907,7 @@ echo -n %s >%s
|
||||
It("podman run with FIPS mode secrets", func() {
|
||||
SkipIfRootless("rootless can not manipulate system-fips file")
|
||||
fipsFile := "/etc/system-fips"
|
||||
err = ioutil.WriteFile(fipsFile, []byte{}, 0755)
|
||||
err = os.WriteFile(fipsFile, []byte{}, 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/run/secrets"})
|
||||
@@ -1070,7 +1069,7 @@ USER mail`, BB)
|
||||
filename := "test.txt"
|
||||
volFile := filepath.Join(vol, filename)
|
||||
data := "Testing --volumes-from!!!"
|
||||
err = ioutil.WriteFile(volFile, []byte(data), 0755)
|
||||
err = os.WriteFile(volFile, []byte(data), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
mountpoint := "/myvol/"
|
||||
|
||||
@@ -1102,7 +1101,7 @@ USER mail`, BB)
|
||||
filename := "test.txt"
|
||||
volFile := filepath.Join(vol, filename)
|
||||
data := "Testing --volumes-from!!!"
|
||||
err = ioutil.WriteFile(volFile, []byte(data), 0755)
|
||||
err = os.WriteFile(volFile, []byte(data), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
mountpoint := "/myvol/"
|
||||
|
||||
@@ -1469,7 +1468,7 @@ USER mail`, BB)
|
||||
return strings.TrimSuffix(i, "\n")
|
||||
}
|
||||
|
||||
curCgroupsBytes, err := ioutil.ReadFile("/proc/self/cgroup")
|
||||
curCgroupsBytes, err := os.ReadFile("/proc/self/cgroup")
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
curCgroups := trim(string(curCgroupsBytes))
|
||||
fmt.Printf("Output:\n%s\n", curCgroups)
|
||||
@@ -1492,7 +1491,7 @@ USER mail`, BB)
|
||||
Skip("Test only works on crun")
|
||||
}
|
||||
|
||||
curCgroupsBytes, err := ioutil.ReadFile("/proc/self/cgroup")
|
||||
curCgroupsBytes, err := os.ReadFile("/proc/self/cgroup")
|
||||
Expect(err).To(BeNil())
|
||||
var curCgroups string = string(curCgroupsBytes)
|
||||
fmt.Printf("Output:\n%s\n", curCgroups)
|
||||
@@ -1509,7 +1508,7 @@ USER mail`, BB)
|
||||
pid := inspectOut[0].State.Pid
|
||||
Expect(pid).To(Not(Equal(0)))
|
||||
|
||||
ctrCgroupsBytes, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid))
|
||||
ctrCgroupsBytes, err := os.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid))
|
||||
Expect(err).To(BeNil())
|
||||
var ctrCgroups string = string(ctrCgroupsBytes)
|
||||
fmt.Printf("Output\n:%s\n", ctrCgroups)
|
||||
@@ -1740,7 +1739,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -1762,7 +1761,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret source=mysecret,type=mount", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -1784,7 +1783,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret source=mysecret,type=mount with target", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret_target", secretFilePath})
|
||||
@@ -1806,7 +1805,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret source=mysecret,type=mount with target at /tmp", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret_target2", secretFilePath})
|
||||
@@ -1828,7 +1827,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret source=mysecret,type=env", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -1844,7 +1843,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret target option", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -1860,7 +1859,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret mount with uid, gid, mode options", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -1887,7 +1886,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run --secret with --user", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -1903,7 +1902,7 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run invalid secret option", func() {
|
||||
secretsString := "somesecretdata"
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte(secretsString), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
@@ -1968,7 +1967,7 @@ WORKDIR /madethis`, BB)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
readFirstLine := func(path string) string {
|
||||
content, err := ioutil.ReadFile(path)
|
||||
content, err := os.ReadFile(path)
|
||||
Expect(err).To(BeNil())
|
||||
return strings.Split(string(content), "\n")[0]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/user"
|
||||
"strings"
|
||||
@@ -55,7 +54,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||
if name == "root" {
|
||||
name = "containers"
|
||||
}
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -181,7 +180,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -213,7 +212,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -251,7 +250,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -280,7 +279,7 @@ var _ = Describe("Podman UserNS support", func() {
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
@@ -768,7 +767,7 @@ VOLUME /test/`, ALPINE)
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
@@ -815,7 +814,7 @@ VOLUME /test/`, ALPINE)
|
||||
name = "containers"
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile("/etc/subuid")
|
||||
content, err := os.ReadFile("/etc/subuid")
|
||||
if err != nil {
|
||||
Skip("cannot read /etc/subuid")
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -185,7 +184,7 @@ default-docker:
|
||||
sigstore: file:///var/lib/containers/sigstore
|
||||
sigstore-staging: file:///var/lib/containers/sigstore
|
||||
`
|
||||
Expect(ioutil.WriteFile("/etc/containers/registries.d/default.yaml", []byte(sigstore), 0755)).To(BeNil())
|
||||
Expect(os.WriteFile("/etc/containers/registries.d/default.yaml", []byte(sigstore), 0755)).To(BeNil())
|
||||
|
||||
session = podmanTest.Podman([]string{"tag", ALPINE, "localhost:5000/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"text/template"
|
||||
@@ -288,7 +287,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
||||
err = registryFileTmpl.Execute(&buffer, ep)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
|
||||
err = ioutil.WriteFile(fmt.Sprintf("%s/registry4.conf", tempdir), buffer.Bytes(), 0644)
|
||||
err = os.WriteFile(fmt.Sprintf("%s/registry4.conf", tempdir), buffer.Bytes(), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
if IsRemote() {
|
||||
podmanTest.RestartRemoteService()
|
||||
@@ -332,7 +331,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
||||
err = registryFileTmpl.Execute(&buffer, ep)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
|
||||
err = ioutil.WriteFile(fmt.Sprintf("%s/registry5.conf", tempdir), buffer.Bytes(), 0644)
|
||||
err = os.WriteFile(fmt.Sprintf("%s/registry5.conf", tempdir), buffer.Bytes(), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
search := podmanTest.Podman([]string{"search", image, "--tls-verify=true"})
|
||||
@@ -372,7 +371,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
||||
err = registryFileBadTmpl.Execute(&buffer, ep)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
|
||||
err = ioutil.WriteFile(fmt.Sprintf("%s/registry6.conf", tempdir), buffer.Bytes(), 0644)
|
||||
err = os.WriteFile(fmt.Sprintf("%s/registry6.conf", tempdir), buffer.Bytes(), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if IsRemote() {
|
||||
@@ -428,7 +427,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
||||
err = registryFileTwoTmpl.Execute(&buffer, ep3)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
|
||||
err = ioutil.WriteFile(fmt.Sprintf("%s/registry8.conf", tempdir), buffer.Bytes(), 0644)
|
||||
err = os.WriteFile(fmt.Sprintf("%s/registry8.conf", tempdir), buffer.Bytes(), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
if IsRemote() {
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -37,7 +36,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret create", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "-d", "file", "--driver-opts", "opt1=val", "a", secretFilePath})
|
||||
@@ -57,7 +56,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret create bad name should fail", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "?!", secretFilePath})
|
||||
@@ -67,7 +66,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret inspect", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
@@ -83,7 +82,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret inspect with --format", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
@@ -99,7 +98,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret inspect multiple secrets", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
@@ -120,7 +119,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret inspect bogus", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
inspect := podmanTest.Podman([]string{"secret", "inspect", "bogus"})
|
||||
@@ -131,7 +130,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret ls", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
@@ -147,7 +146,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret ls --quiet", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
secretName := "a"
|
||||
@@ -177,7 +176,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret ls with filters", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
secret1 := "Secret1"
|
||||
@@ -231,7 +230,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret ls with Go template", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
@@ -247,7 +246,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret rm", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
@@ -268,7 +267,7 @@ var _ = Describe("Podman secret", func() {
|
||||
|
||||
It("podman secret rm --all", func() {
|
||||
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
|
||||
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
err := os.WriteFile(secretFilePath, []byte("mysecret"), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "a", secretFilePath})
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -204,7 +203,7 @@ var _ = Describe("Podman start", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
readFirstLine := func(path string) string {
|
||||
content, err := ioutil.ReadFile(path)
|
||||
content, err := os.ReadFile(path)
|
||||
Expect(err).To(BeNil())
|
||||
return strings.Split(string(content), "\n")[0]
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -276,7 +275,7 @@ var _ = Describe("Podman stop", func() {
|
||||
|
||||
It("podman stop --cidfile", func() {
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile := tmpDir + "cid"
|
||||
|
||||
@@ -300,7 +299,7 @@ var _ = Describe("Podman stop", func() {
|
||||
|
||||
It("podman stop multiple --cidfile", func() {
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
tmpDir, err := os.MkdirTemp("", "")
|
||||
Expect(err).To(BeNil())
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -27,7 +26,7 @@ var _ = Describe("podman system connection", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
ConfPath.Value, ConfPath.IsSet = os.LookupEnv("CONTAINERS_CONF")
|
||||
conf, err := ioutil.TempFile("", "containersconf")
|
||||
conf, err := os.CreateTemp("", "containersconf")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
os.Setenv("CONTAINERS_CONF", conf.Name())
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -89,7 +89,7 @@ var _ = Describe("podman system service", func() {
|
||||
defer resp.Body.Close()
|
||||
Expect(resp).To(HaveHTTPStatus(http.StatusOK))
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
Expect(body).ShouldNot(BeEmpty())
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -51,7 +50,7 @@ WantedBy=default.target
|
||||
SkipIfRootless("rootless can not write to /etc")
|
||||
SkipIfContainerized("test does not have systemd as pid 1")
|
||||
|
||||
sysFile := ioutil.WriteFile("/etc/systemd/system/redis.service", []byte(systemdUnitFile), 0644)
|
||||
sysFile := os.WriteFile("/etc/systemd/system/redis.service", []byte(systemdUnitFile), 0644)
|
||||
Expect(sysFile).To(BeNil())
|
||||
defer func() {
|
||||
stop := SystemExec("bash", []string{"-c", "systemctl stop redis"})
|
||||
@@ -137,7 +136,7 @@ RUN mkdir -p /usr/lib/systemd/; touch /usr/lib/systemd/systemd
|
||||
CMD /usr/lib/systemd/systemd`, ALPINE)
|
||||
|
||||
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||
err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
err := os.WriteFile(containerfilePath, []byte(containerfile), 0755)
|
||||
Expect(err).To(BeNil())
|
||||
session := podmanTest.Podman([]string{"build", "-t", "systemd", "--file", containerfilePath, podmanTest.TempDir})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@@ -167,7 +166,7 @@ CMD /usr/lib/systemd/systemd`, ALPINE)
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
pidFile := strings.TrimSuffix(session.OutputToString(), "\n")
|
||||
_, err := ioutil.ReadFile(pidFile)
|
||||
_, err := os.ReadFile(pidFile)
|
||||
Expect(err).To(BeNil())
|
||||
})
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package integration
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -57,7 +56,7 @@ var _ = Describe("Podman trust", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
var teststruct map[string][]map[string]string
|
||||
policyContent, err := ioutil.ReadFile(policyJSON)
|
||||
policyContent, err := os.ReadFile(policyJSON)
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -111,7 +110,7 @@ var _ = Describe("Podman trust", func() {
|
||||
session := podmanTest.Podman([]string{"image", "trust", "show", "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--raw"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
contents, err := ioutil.ReadFile(filepath.Join(INTEGRATION_ROOT, "test/policy.json"))
|
||||
contents, err := os.ReadFile(filepath.Join(INTEGRATION_ROOT, "test/policy.json"))
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
Expect(session.OutputToString()).To(BeValidJSON())
|
||||
Expect(string(session.Out.Contents())).To(Equal(string(contents) + "\n"))
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
@@ -78,7 +77,7 @@ func startServer(socketPath string) error {
|
||||
logrus.Debugf("Starting server...")
|
||||
|
||||
if config.path == "" {
|
||||
path, err := ioutil.TempDir("", "test_volume_plugin")
|
||||
path, err := os.MkdirTemp("", "test_volume_plugin")
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting directory for plugin: %w", err)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package utils_test
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -113,7 +113,7 @@ var _ = Describe("Common functions test", func() {
|
||||
Expect(err).To(BeNil(), "Can not find the JSON file after we write it.")
|
||||
defer read.Close()
|
||||
|
||||
bytes, err := ioutil.ReadAll(read)
|
||||
bytes, err := io.ReadAll(read)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = json.Unmarshal(bytes, compareData)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -100,7 +99,7 @@ func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string
|
||||
}
|
||||
|
||||
if timeDir := os.Getenv(EnvTimeDir); timeDir != "" {
|
||||
timeFile, err := ioutil.TempFile(timeDir, ".time")
|
||||
timeFile, err := os.CreateTemp(timeDir, ".time")
|
||||
if err != nil {
|
||||
Fail(fmt.Sprintf("Error creating time file: %v", err))
|
||||
}
|
||||
@@ -374,7 +373,7 @@ func (s *PodmanSession) WaitWithTimeout(timeout int) {
|
||||
|
||||
// CreateTempDirInTempDir create a temp dir with prefix podman_test
|
||||
func CreateTempDirInTempDir() (string, error) {
|
||||
return ioutil.TempDir("", "podman_test")
|
||||
return os.MkdirTemp("", "podman_test")
|
||||
}
|
||||
|
||||
// SystemExec is used to exec a system command to check its exit code or output
|
||||
@@ -497,7 +496,7 @@ func WriteJSONFile(data []byte, filePath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile(filePath, formatJSON, 0644)
|
||||
return os.WriteFile(filePath, formatJSON, 0644)
|
||||
}
|
||||
|
||||
// Containerized check the podman command run inside container
|
||||
@@ -506,7 +505,7 @@ func Containerized() bool {
|
||||
if container != "" {
|
||||
return true
|
||||
}
|
||||
b, err := ioutil.ReadFile(ProcessOneCgroupPath)
|
||||
b, err := os.ReadFile(ProcessOneCgroupPath)
|
||||
if err != nil {
|
||||
// shrug, if we cannot read that file, return false
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user