refactor: move from io/ioutil to io and os packages
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. [1]: https://golang.org/doc/go1.16#ioutil Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
parent
0f3047203d
commit
9085531583
|
@ -1,7 +1,6 @@
|
|||
package api_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
@ -154,7 +153,7 @@ var _ = BeforeEach(func() {
|
|||
fakeClock = fakeclock.NewFakeClock(time.Unix(123, 456))
|
||||
|
||||
var err error
|
||||
cliDownloadsDir, err = ioutil.TempDir("", "cli-downloads")
|
||||
cliDownloadsDir, err = os.MkdirTemp("", "cli-downloads")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
constructedEventHandler = &fakeEventHandlerFactory{}
|
||||
|
|
|
@ -3,7 +3,7 @@ package api_test
|
|||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -111,7 +111,7 @@ var _ = Describe("ArtifactRepository API", func() {
|
|||
})
|
||||
|
||||
It("returns the artifact record", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
|
|
@ -3,7 +3,6 @@ package auth_test
|
|||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
|
@ -104,7 +103,7 @@ var _ = Describe("CheckAdminHandler", func() {
|
|||
})
|
||||
|
||||
It("proxies to the handler", func() {
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("simple hello"))
|
||||
})
|
||||
|
@ -124,7 +123,7 @@ var _ = Describe("CheckAdminHandler", func() {
|
|||
|
||||
It("rejects the request", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusUnauthorized))
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("nope\n"))
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package auth_test
|
|||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
|
@ -92,7 +91,7 @@ var _ = Describe("AuthenticationHandler", func() {
|
|||
})
|
||||
|
||||
It("proxies to the handler", func() {
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("simple hello"))
|
||||
})
|
||||
|
@ -108,7 +107,7 @@ var _ = Describe("AuthenticationHandler", func() {
|
|||
})
|
||||
|
||||
It("rejects the request", func() {
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("nope\n"))
|
||||
})
|
||||
|
@ -155,7 +154,7 @@ var _ = Describe("AuthenticationHandler", func() {
|
|||
})
|
||||
|
||||
It("rejects the request", func() {
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("nope\n"))
|
||||
})
|
||||
|
@ -171,7 +170,7 @@ var _ = Describe("AuthenticationHandler", func() {
|
|||
})
|
||||
|
||||
It("proxies to the handler", func() {
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("simple hello"))
|
||||
})
|
||||
|
@ -188,7 +187,7 @@ var _ = Describe("AuthenticationHandler", func() {
|
|||
})
|
||||
|
||||
It("proxies to the handler", func() {
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("simple hello"))
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package auth_test
|
|||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
|
@ -105,7 +104,7 @@ var _ = Describe("CheckAuthorizationHandler", func() {
|
|||
})
|
||||
|
||||
It("proxies to the handler", func() {
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("simple hello"))
|
||||
})
|
||||
|
@ -118,7 +117,7 @@ var _ = Describe("CheckAuthorizationHandler", func() {
|
|||
|
||||
It("returns 403", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusForbidden))
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("nope\n"))
|
||||
})
|
||||
|
@ -132,7 +131,7 @@ var _ = Describe("CheckAuthorizationHandler", func() {
|
|||
|
||||
It("returns 401", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusUnauthorized))
|
||||
responseBody, err := ioutil.ReadAll(response.Body)
|
||||
responseBody, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(responseBody)).To(Equal("nope\n"))
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -125,7 +125,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("returns the created build", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -263,7 +263,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("returns all builds", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -398,7 +398,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("returns all builds", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -623,7 +623,7 @@ var _ = Describe("Builds API", func() {
|
|||
buildID := dbBuildFactory.BuildForAPIArgsForCall(0)
|
||||
Expect(buildID).To(Equal(1))
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -762,7 +762,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("returns the build with it's input and output versioned resources", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -895,7 +895,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("serves the request via the event handler", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal("fake event handler factory was here"))
|
||||
|
@ -957,7 +957,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("serves the request via the event handler", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal("fake event handler factory was here"))
|
||||
|
@ -1271,7 +1271,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("returns the build preparation", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -1491,7 +1491,7 @@ var _ = Describe("Builds API", func() {
|
|||
})
|
||||
|
||||
It("returns the plan", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
|
|
@ -2,7 +2,7 @@ package api_test
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -103,7 +103,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML(`
|
||||
|
@ -131,7 +131,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML(`
|
||||
|
@ -159,7 +159,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML(`
|
||||
|
@ -187,7 +187,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML(`
|
||||
|
@ -216,7 +216,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML(`
|
||||
|
@ -229,7 +229,7 @@ var _ = Describe("cc.xml", func() {
|
|||
|
||||
Context("when no last build exists", func() {
|
||||
It("returns the CC.xml without the job", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML("<Projects></Projects>"))
|
||||
|
@ -247,7 +247,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML("<Projects></Projects>"))
|
||||
|
@ -292,7 +292,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the proper web url in the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML(`
|
||||
|
@ -313,7 +313,7 @@ var _ = Describe("cc.xml", func() {
|
|||
})
|
||||
|
||||
It("returns the CC.xml", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchXML("<Projects></Projects>"))
|
||||
|
|
|
@ -2,7 +2,7 @@ package api_test
|
|||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -95,7 +95,7 @@ var _ = Describe("CLI Downloads API", func() {
|
|||
})
|
||||
|
||||
It("returns the file binary", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("soi soi soi")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("soi soi soi")))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -123,7 +123,7 @@ var _ = Describe("CLI Downloads API", func() {
|
|||
})
|
||||
|
||||
It("returns the file binary", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("soi soi soi.notavirus.bat")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("soi soi soi.notavirus.bat")))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -141,7 +141,7 @@ var _ = Describe("CLI Downloads API", func() {
|
|||
})
|
||||
|
||||
It("returns the file binary", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("soi soi soi")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("soi soi soi")))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -159,7 +159,7 @@ var _ = Describe("CLI Downloads API", func() {
|
|||
})
|
||||
|
||||
It("returns the file binary", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("soi soi soi.notavirus.bat")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("soi soi soi.notavirus.bat")))
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -190,7 +190,7 @@ var _ = Describe("Config API", func() {
|
|||
})
|
||||
|
||||
It("returns an error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"instance vars are malformed: unexpected end of JSON input"
|
||||
|
@ -371,7 +371,7 @@ var _ = Describe("Config API", func() {
|
|||
})
|
||||
|
||||
It("returns warnings in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"warnings": [
|
||||
{
|
||||
|
@ -404,7 +404,7 @@ var _ = Describe("Config API", func() {
|
|||
})
|
||||
|
||||
It("returns warnings in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"pipeline: identifier cannot be an empty string"
|
||||
|
@ -439,7 +439,7 @@ var _ = Describe("Config API", func() {
|
|||
})
|
||||
|
||||
It("returns error JSON", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"malformed config: error converting YAML to JSON: yaml: line 1: did not find expected node content"
|
||||
|
@ -470,7 +470,7 @@ var _ = Describe("Config API", func() {
|
|||
})
|
||||
|
||||
It("returns error JSON", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"malformed config: error converting YAML to JSON: yaml: line 1: did not find expected node content"
|
||||
|
@ -530,7 +530,7 @@ var _ = Describe("Config API", func() {
|
|||
})
|
||||
|
||||
It("returns the error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("failed to save config: oh no!")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("failed to save config: oh no!")))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -569,7 +569,7 @@ var _ = Describe("Config API", func() {
|
|||
})
|
||||
|
||||
It("returns error JSON", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"invalid groups:\n\tgroup 'some-group' has unknown resource 'missing-resource'\n"
|
||||
|
@ -641,7 +641,7 @@ jobs:
|
|||
BAZ: 1.9`
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
It("returns 200", func() {
|
||||
|
@ -765,7 +765,7 @@ jobs:
|
|||
file: some/task/config.yaml`
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
ExpectCredsValidationPass()
|
||||
|
@ -786,7 +786,7 @@ jobs:
|
|||
- get: some-resource`
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
ExpectCredsValidationPass()
|
||||
|
@ -806,7 +806,7 @@ jobs:
|
|||
- get: some-resource`
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
ExpectCredsValidationPass()
|
||||
|
@ -830,7 +830,7 @@ jobs:
|
|||
FOO: ((BAR))`
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
ExpectCredsValidationPass()
|
||||
|
@ -854,7 +854,7 @@ jobs:
|
|||
FOO: ((BAR))`
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
ExpectCredsValidationPass()
|
||||
|
@ -879,7 +879,7 @@ jobs:
|
|||
FOO: ((BAR))`
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
ExpectCredsValidationPass()
|
||||
|
@ -949,7 +949,7 @@ jobs:
|
|||
}
|
||||
|
||||
request.Header.Set("Content-Type", "application/x-yaml")
|
||||
request.Body = ioutil.NopCloser(bytes.NewBufferString(payload))
|
||||
request.Body = io.NopCloser(bytes.NewBufferString(payload))
|
||||
})
|
||||
|
||||
Context("when the check_creds param is set", func() {
|
||||
|
@ -989,7 +989,7 @@ jobs:
|
|||
})
|
||||
|
||||
It("returns the credential name that was missing", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{"errors":["credential validation failed\n\n1 error occurred:\n\t* failed to interpolate task config: undefined vars: BAR\n\n"]}`))
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{"errors":["credential validation failed\n\n1 error occurred:\n\t* failed to interpolate task config: undefined vars: BAR\n\n"]}`))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ jobs:
|
|||
})
|
||||
|
||||
It("returns the credential name that was missing", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{"errors":["credential validation failed\n\n1 error occurred:\n\t* failed to interpolate task config: undefined vars: BAR\n\n"]}`))
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{"errors":["credential validation failed\n\n1 error occurred:\n\t* failed to interpolate task config: undefined vars: BAR\n\n"]}`))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1037,7 +1037,7 @@ jobs:
|
|||
})
|
||||
|
||||
It("returns the error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("failed to save config: oh no!")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("failed to save config: oh no!")))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ jobs:
|
|||
})
|
||||
|
||||
It("returns error JSON", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"invalid groups:\n\tgroup 'some-group' has unknown resource 'missing-resource'\n"
|
||||
|
@ -1094,7 +1094,7 @@ jobs:
|
|||
})
|
||||
|
||||
It("returns an error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"instance vars are malformed: unexpected end of JSON input"
|
||||
|
@ -1265,7 +1265,7 @@ jobs:
|
|||
})
|
||||
|
||||
It("returns an error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(ContainSubstring(`malformed config: error unmarshaling JSON: while decoding JSON: json: unknown field \"pubic\"`))
|
||||
Expect(io.ReadAll(response.Body)).To(ContainSubstring(`malformed config: error unmarshaling JSON: while decoding JSON: json: unknown field \"pubic\"`))
|
||||
})
|
||||
|
||||
It("does not save it", func() {
|
||||
|
@ -1291,7 +1291,7 @@ jobs:
|
|||
})
|
||||
|
||||
It("returns an error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"config version is malformed: expected integer"
|
||||
|
|
|
@ -3,7 +3,7 @@ package configserver
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
|
@ -41,7 +41,7 @@ func (s *Server) SaveConfig(w http.ResponseWriter, r *http.Request) {
|
|||
var config atc.Config
|
||||
switch r.Header.Get("Content-type") {
|
||||
case "application/json", "application/x-yaml":
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
HandleBadRequest(w, fmt.Sprintf("read failed: %s", err))
|
||||
return
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
@ -133,7 +132,7 @@ var _ = Describe("Containers API", func() {
|
|||
response, err := client.Do(req)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -184,7 +183,7 @@ var _ = Describe("Containers API", func() {
|
|||
response, err := client.Do(req)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -473,7 +472,7 @@ var _ = Describe("Containers API", func() {
|
|||
response, err := client.Do(req)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -1047,7 +1046,7 @@ var _ = Describe("Containers API", func() {
|
|||
response, err := client.Do(req)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -1066,7 +1065,7 @@ var _ = Describe("Containers API", func() {
|
|||
response, err := client.Do(req)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
|
|
@ -2,7 +2,7 @@ package containerserver
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/concourse/concourse/atc/metric"
|
||||
|
@ -24,7 +24,7 @@ func (s *Server) ReportWorkerContainers(w http.ResponseWriter, r *http.Request)
|
|||
|
||||
defer r.Body.Close()
|
||||
|
||||
data, err := ioutil.ReadAll(r.Body)
|
||||
data, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
logger.Error("failed-to-read-body", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
|
@ -63,7 +63,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("contains the version", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(fmt.Sprintf(`{
|
||||
|
@ -97,7 +97,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
}
|
||||
Expect(response).Should(IncludeHeaderEntries(expectedHeaderEntries))
|
||||
|
||||
body, err = ioutil.ReadAll(response.Body)
|
||||
body, err = io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -128,7 +128,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns all jobs from public pipelines and pipelines in authenticated teams", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -195,7 +195,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns empty array", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
@ -428,7 +428,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns the job's name, if it's paused, and any running and finished builds", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -599,7 +599,7 @@ var _ = Describe("Jobs API", func() {
|
|||
response, err := client.Get(server.URL + "/api/v1/teams/some-team/pipelines/some-pipeline/jobs/some-job/badge?title=cov")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(strings.Contains(string(body), `
|
||||
|
@ -611,7 +611,7 @@ var _ = Describe("Jobs API", func() {
|
|||
response, err := client.Get(server.URL + "/api/v1/teams/some-team/pipelines/some-pipeline/jobs/some-job/badge")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(strings.Contains(string(body), `
|
||||
|
@ -623,7 +623,7 @@ var _ = Describe("Jobs API", func() {
|
|||
response, err := client.Get(server.URL + "/api/v1/teams/some-team/pipelines/some-pipeline/jobs/some-job/badge?title=")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(strings.Contains(string(body), `
|
||||
|
@ -635,7 +635,7 @@ var _ = Describe("Jobs API", func() {
|
|||
response, err := client.Get(server.URL + "/api/v1/teams/some-team/pipelines/some-pipeline/jobs/some-job/badge?title=%24cov")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(strings.Contains(string(body), `
|
||||
|
@ -671,7 +671,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns some SVG showing that the job is successful", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -724,7 +724,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns some SVG showing that the job has failed", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -777,7 +777,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns some SVG showing that the job was aborted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -830,7 +830,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns some SVG showing that the job has errored", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -863,7 +863,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns an unknown badge", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="98" height="20">
|
||||
|
@ -1084,7 +1084,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns each job's name and any running and finished builds", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -1189,7 +1189,7 @@ var _ = Describe("Jobs API", func() {
|
|||
fakePipeline.DashboardReturns(dashboardResponse, nil)
|
||||
})
|
||||
It("should return an empty array", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
@ -1348,7 +1348,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns the builds", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -1641,7 +1641,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns the build", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -1847,7 +1847,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns the inputs", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -1936,7 +1936,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns the build", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -2183,7 +2183,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("returns the build", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -2418,7 +2418,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("it returns the number of rows deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"caches_removed": 1}`))
|
||||
|
@ -2430,7 +2430,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("it returns that 0 rows were deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"caches_removed": 0}`))
|
||||
|
@ -2469,7 +2469,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("it returns the number of rows deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"caches_removed": 1}`))
|
||||
|
@ -2481,7 +2481,7 @@ var _ = Describe("Jobs API", func() {
|
|||
})
|
||||
|
||||
It("it returns that 0 rows were deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"caches_removed": 0}`))
|
||||
|
|
|
@ -2,7 +2,7 @@ package api_test
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
|
@ -74,7 +74,7 @@ var _ = Describe("Log Level API", func() {
|
|||
})
|
||||
|
||||
It("returns the current log level", func() {
|
||||
Expect(ioutil.ReadAll(getResponse.Body)).To(Equal([]byte(atcLevel)))
|
||||
Expect(io.ReadAll(getResponse.Body)).To(Equal([]byte(atcLevel)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package loglevelserver
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func (s *Server) SetMinLevel(w http.ResponseWriter, r *http.Request) {
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -116,7 +116,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns a JSON array of pipeline objects", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(body).To(MatchJSON(`[
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
|
||||
Context("when not authenticated", func() {
|
||||
It("returns only public pipelines", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
var pipelines []map[string]interface{}
|
||||
|
@ -188,7 +188,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns all pipelines of the team + all public pipelines", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(dbPipelineFactory.VisiblePipelinesCallCount()).To(Equal(1))
|
||||
|
@ -215,7 +215,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
Expect(dbPipelineFactory.AllPipelinesCallCount()).To(Equal(1),
|
||||
"Expected AllPipelines() to be called once")
|
||||
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
var pipelinesResponse []atc.Pipeline
|
||||
|
@ -273,7 +273,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns a JSON array of pipeline objects", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(body).To(MatchJSON(`[
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns all team's pipelines", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
var pipelines []map[string]interface{}
|
||||
json.Unmarshal(body, &pipelines)
|
||||
|
@ -344,7 +344,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns only team's public pipelines", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
var pipelines []map[string]interface{}
|
||||
json.Unmarshal(body, &pipelines)
|
||||
|
@ -362,7 +362,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns only team's public pipelines", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
var pipelines []map[string]interface{}
|
||||
json.Unmarshal(body, &pipelines)
|
||||
|
@ -442,7 +442,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns a pipeline JSON", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -637,7 +637,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns an unknown badge", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -670,7 +670,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns a successful badge", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -703,7 +703,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns an aborted badge", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -736,7 +736,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns an errored badge", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -769,7 +769,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns a failed badge", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
@ -1309,7 +1309,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
|
||||
It("returns 400", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusBadRequest))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(ContainSubstring("pipeline 'a-pipeline' not found"))
|
||||
Expect(io.ReadAll(response.Body)).To(ContainSubstring("pipeline 'a-pipeline' not found"))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1409,7 +1409,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
|
||||
It("returns 400", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusBadRequest))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(ContainSubstring("pipeline 'a-pipeline' not found"))
|
||||
Expect(io.ReadAll(response.Body)).To(ContainSubstring("pipeline 'a-pipeline' not found"))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -1553,7 +1553,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns a json representation of all the versions in the pipeline", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -1722,7 +1722,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns a warning in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"warnings": [
|
||||
{
|
||||
|
@ -1740,7 +1740,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
|
||||
It("returns 400 Bad Request and an error in the response body", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusBadRequest))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"pipeline: identifier cannot be an empty string"
|
||||
|
@ -1887,7 +1887,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns the builds", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -2067,7 +2067,7 @@ var _ = Describe("Pipelines API", func() {
|
|||
})
|
||||
|
||||
It("returns the created build", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
|
|
@ -2,7 +2,7 @@ package pipelineserver_test
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
|
@ -67,7 +67,7 @@ var _ = Describe("Rejected Archived Handler", func() {
|
|||
Expect(response.StatusCode).To(Equal(http.StatusConflict))
|
||||
})
|
||||
It("returns an error in the body", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(body).To(ContainSubstring("action not allowed for an archived pipeline"))
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ package pipelineserver
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
|
@ -15,7 +15,7 @@ func (s *Server) RenamePipeline(team db.Team) http.Handler {
|
|||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
logger := s.logger.Session("rename-pipeline")
|
||||
|
||||
data, err := ioutil.ReadAll(r.Body)
|
||||
data, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
logger.Error("failed-to-read-body", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
|
|
@ -3,7 +3,7 @@ package policychecker
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
|
@ -57,7 +57,7 @@ func (c *checker) Check(action string, acc accessor.Access, req *http.Request) (
|
|||
|
||||
switch ct := req.Header.Get("Content-type"); ct {
|
||||
case "application/json", "text/vnd.yaml", "text/yaml", "text/x-yaml", "application/x-yaml":
|
||||
body, err := ioutil.ReadAll(req.Body)
|
||||
body, err := io.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if len(body) > 0 {
|
||||
|
@ -70,7 +70,7 @@ func (c *checker) Check(action string, acc accessor.Access, req *http.Request) (
|
|||
return nil, err
|
||||
}
|
||||
|
||||
req.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||
req.Body = io.NopCloser(bytes.NewBuffer(body))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package policychecker_test
|
|||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
|
@ -185,7 +185,7 @@ var _ = Describe("PolicyChecker", func() {
|
|||
})
|
||||
|
||||
It("request body should still be readable", func() {
|
||||
body, err := ioutil.ReadAll(fakeRequest.Body)
|
||||
body, err := io.ReadAll(fakeRequest.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(body).To(Equal([]byte("a: b")))
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ package policychecker_test
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
|
@ -79,7 +79,7 @@ var _ = Describe("Handler", func() {
|
|||
It("return http forbidden", func() {
|
||||
Expect(responseWriter.Code).To(Equal(http.StatusForbidden))
|
||||
|
||||
msg, err := ioutil.ReadAll(responseWriter.Body)
|
||||
msg, err := io.ReadAll(responseWriter.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(msg)).To(ContainSubstring("a policy says you can't do that"))
|
||||
Expect(string(msg)).To(ContainSubstring("another policy also says you can't do that"))
|
||||
|
@ -115,7 +115,7 @@ var _ = Describe("Handler", func() {
|
|||
It("return http bad request", func() {
|
||||
Expect(responseWriter.Code).To(Equal(http.StatusBadRequest))
|
||||
|
||||
msg, err := ioutil.ReadAll(responseWriter.Body)
|
||||
msg, err := io.ReadAll(responseWriter.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(string(msg)).To(Equal("policy check error: some-error"))
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -100,7 +100,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns each resource, including their build", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -161,7 +161,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns empty array", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
@ -274,7 +274,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns each resource", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -326,7 +326,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns each resource", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -364,7 +364,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns an empty list", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
@ -756,7 +756,7 @@ var _ = Describe("Resources API", func() {
|
|||
|
||||
It("returns 201", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusCreated))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
"id": 10,
|
||||
"name": "some-name",
|
||||
"team_name": "some-team",
|
||||
|
@ -851,7 +851,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns each resource type", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -894,7 +894,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns each resource type", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -1021,7 +1021,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns the resource json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -1108,7 +1108,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns the resource json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -1151,7 +1151,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns the resource json describing the pinned version", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -1182,7 +1182,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns the pin comment in the response json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -1245,7 +1245,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns the resource json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -1434,7 +1434,7 @@ var _ = Describe("Resources API", func() {
|
|||
|
||||
It("returns 201", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusCreated))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
"id": 10,
|
||||
"name": "some-name",
|
||||
"team_name": "some-team",
|
||||
|
@ -1625,7 +1625,7 @@ var _ = Describe("Resources API", func() {
|
|||
|
||||
It("returns 201", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusCreated))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
"id": 10,
|
||||
"name": "some-name",
|
||||
"team_name": "some-team",
|
||||
|
@ -1764,7 +1764,7 @@ var _ = Describe("Resources API", func() {
|
|||
|
||||
It("returns 201", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusCreated))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{
|
||||
"id": 10,
|
||||
"name": "some-name",
|
||||
"team_name": "some-team",
|
||||
|
@ -1888,7 +1888,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns the number of rows deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"caches_removed": 1}`))
|
||||
|
@ -1922,7 +1922,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns the number of rows deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"caches_removed": 1}`))
|
||||
|
@ -1936,7 +1936,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns that 0 rows were deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"caches_removed": 0}`))
|
||||
|
@ -2104,7 +2104,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns shared resources", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -2153,7 +2153,7 @@ var _ = Describe("Resources API", func() {
|
|||
|
||||
It("returns 500", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("some-error")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("some-error")))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -2291,7 +2291,7 @@ var _ = Describe("Resources API", func() {
|
|||
})
|
||||
|
||||
It("returns shared resources and resource types", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -2340,7 +2340,7 @@ var _ = Describe("Resources API", func() {
|
|||
|
||||
It("returns 500", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("some-error")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("some-error")))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -94,7 +94,7 @@ var _ = Describe("Teams API", func() {
|
|||
})
|
||||
|
||||
It("should return the teams the user is authorized for", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -171,7 +171,7 @@ var _ = Describe("Teams API", func() {
|
|||
})
|
||||
|
||||
It("returns a team JSON", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`
|
||||
|
@ -356,7 +356,7 @@ var _ = Describe("Teams API", func() {
|
|||
})
|
||||
|
||||
It("returns a warning in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"warnings": [
|
||||
{
|
||||
|
@ -571,7 +571,7 @@ var _ = Describe("Teams API", func() {
|
|||
})
|
||||
|
||||
It("returns a warning in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"warnings": [
|
||||
{
|
||||
|
@ -589,7 +589,7 @@ var _ = Describe("Teams API", func() {
|
|||
|
||||
It("returns a warning in the response body", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusBadRequest))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`
|
||||
{
|
||||
"errors": [
|
||||
"team: identifier cannot be an empty string"
|
||||
|
@ -733,7 +733,7 @@ var _ = Describe("Teams API", func() {
|
|||
})
|
||||
|
||||
It("returns the builds", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
|
|
@ -2,7 +2,7 @@ package teamserver
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/concourse/concourse/atc"
|
||||
|
@ -14,7 +14,7 @@ func (s *Server) RenameTeam(team db.Team) http.Handler {
|
|||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
logger := s.logger.Session("rename-team")
|
||||
|
||||
data, err := ioutil.ReadAll(r.Body)
|
||||
data, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
logger.Error("failed-to-read-body", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
|
|
@ -2,7 +2,7 @@ package api_test
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -67,7 +67,7 @@ var _ = Describe("Users API", func() {
|
|||
})
|
||||
|
||||
It("returns the current user", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{
|
||||
|
@ -159,7 +159,7 @@ var _ = Describe("Users API", func() {
|
|||
})
|
||||
|
||||
It("returns an empty array", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
@ -182,7 +182,7 @@ var _ = Describe("Users API", func() {
|
|||
})
|
||||
|
||||
It("returns all users logged in since table creation", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[{
|
||||
|
@ -242,7 +242,7 @@ var _ = Describe("Users API", func() {
|
|||
dbUserFactory.GetAllUsersByLoginDateReturns([]db.User{user1}, nil)
|
||||
})
|
||||
It("returns users", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[{
|
||||
|
@ -259,7 +259,7 @@ var _ = Describe("Users API", func() {
|
|||
date = "1969-14-30"
|
||||
})
|
||||
It("returns an error message", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"error": "wrong date format (yyyy-mm-dd)"}`))
|
||||
|
@ -275,7 +275,7 @@ var _ = Describe("Users API", func() {
|
|||
date = ""
|
||||
})
|
||||
It("returns an empty array", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
|
|
@ -3,7 +3,7 @@ package api_test
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -129,7 +129,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns the json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -162,7 +162,7 @@ var _ = Describe("Versions API", func() {
|
|||
Context("when resource is not public", func() {
|
||||
Context("when the user is not authenticated", func() {
|
||||
It("returns the json without version metadata", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -186,7 +186,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns the json without version metadata", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -367,7 +367,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns the json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -936,7 +936,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns the json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -972,7 +972,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns an empty list", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
@ -1136,7 +1136,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns the json", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -1172,7 +1172,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns an empty list", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
@ -1261,7 +1261,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns the number of rows deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"versions_removed": 3}`))
|
||||
|
@ -1275,7 +1275,7 @@ var _ = Describe("Versions API", func() {
|
|||
|
||||
It("returns 500", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("failed")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("failed")))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -1382,7 +1382,7 @@ var _ = Describe("Versions API", func() {
|
|||
})
|
||||
|
||||
It("returns the number of rows deleted", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`{"versions_removed": 3}`))
|
||||
|
@ -1396,7 +1396,7 @@ var _ = Describe("Versions API", func() {
|
|||
|
||||
It("returns 500", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusInternalServerError))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("failed")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("failed")))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
|
@ -136,7 +135,7 @@ var _ = Describe("Volumes API", func() {
|
|||
})
|
||||
|
||||
It("returns all volumes", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -268,7 +267,7 @@ var _ = Describe("Volumes API", func() {
|
|||
})
|
||||
|
||||
It("returns a partial list of volumes", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -364,7 +363,7 @@ var _ = Describe("Volumes API", func() {
|
|||
})
|
||||
|
||||
It("returns all volumes", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[
|
||||
|
@ -390,7 +389,7 @@ var _ = Describe("Volumes API", func() {
|
|||
})
|
||||
|
||||
It("returns empty list of volumes", func() {
|
||||
body, err := ioutil.ReadAll(response.Body)
|
||||
body, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(body).To(MatchJSON(`[]`))
|
||||
|
|
|
@ -2,7 +2,7 @@ package volumeserver
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/concourse/concourse/atc/metric"
|
||||
|
@ -25,7 +25,7 @@ func (s *Server) ReportWorkerVolumes(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
defer r.Body.Close()
|
||||
|
||||
data, err := ioutil.ReadAll(r.Body)
|
||||
data, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
logger.Error("failed-to-read-body", err)
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
|
|
@ -3,7 +3,7 @@ package api_test
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -44,7 +44,7 @@ var _ = Describe("Wall API", func() {
|
|||
|
||||
It("returns only message", func() {
|
||||
Expect(dbWall.GetWallCallCount()).To(Equal(1))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{"message":"test message"}`))
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{"message":"test message"}`))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -88,7 +88,7 @@ var _ = Describe("Wall API", func() {
|
|||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
req, err := http.NewRequest("PUT", server.URL+"/api/v1/wall",
|
||||
ioutil.NopCloser(bytes.NewBuffer(payload)))
|
||||
io.NopCloser(bytes.NewBuffer(payload)))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
response, err = client.Do(req)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -197,7 +197,7 @@ var _ = Describe("Workers API", func() {
|
|||
payload, err := json.Marshal(worker)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
req, err := http.NewRequest("POST", server.URL+"/api/v1/workers?ttl="+ttl, ioutil.NopCloser(bytes.NewBuffer(payload)))
|
||||
req, err := http.NewRequest("POST", server.URL+"/api/v1/workers?ttl="+ttl, io.NopCloser(bytes.NewBuffer(payload)))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
response, err = client.Do(req)
|
||||
|
@ -425,7 +425,7 @@ var _ = Describe("Workers API", func() {
|
|||
})
|
||||
|
||||
It("returns the validation error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("malformed ttl")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("malformed ttl")))
|
||||
})
|
||||
|
||||
It("does not save it", func() {
|
||||
|
@ -443,7 +443,7 @@ var _ = Describe("Workers API", func() {
|
|||
})
|
||||
|
||||
It("returns the validation error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("missing garden address")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("missing garden address")))
|
||||
})
|
||||
|
||||
It("does not save it", func() {
|
||||
|
@ -461,7 +461,7 @@ var _ = Describe("Workers API", func() {
|
|||
})
|
||||
|
||||
It("returns the validation error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("invalid worker version, only numeric characters are allowed")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("invalid worker version, only numeric characters are allowed")))
|
||||
})
|
||||
|
||||
It("does not save it", func() {
|
||||
|
@ -752,7 +752,7 @@ var _ = Describe("Workers API", func() {
|
|||
|
||||
It("returns 400", func() {
|
||||
Expect(response.StatusCode).To(Equal(http.StatusBadRequest))
|
||||
Expect(ioutil.ReadAll(response.Body)).To(MatchJSON(`{"stderr":"cannot prune running worker"}`))
|
||||
Expect(io.ReadAll(response.Body)).To(MatchJSON(`{"stderr":"cannot prune running worker"}`))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -812,7 +812,7 @@ var _ = Describe("Workers API", func() {
|
|||
payload, err := json.Marshal(worker)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
req, err := http.NewRequest("PUT", server.URL+"/api/v1/workers/"+workerName+"/heartbeat?ttl="+ttlStr, ioutil.NopCloser(bytes.NewBuffer(payload)))
|
||||
req, err := http.NewRequest("PUT", server.URL+"/api/v1/workers/"+workerName+"/heartbeat?ttl="+ttlStr, io.NopCloser(bytes.NewBuffer(payload)))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
response, err = client.Do(req)
|
||||
|
@ -831,7 +831,7 @@ var _ = Describe("Workers API", func() {
|
|||
})
|
||||
|
||||
It("returns saved worker", func() {
|
||||
contents, err := ioutil.ReadAll(response.Body)
|
||||
contents, err := io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(contents).To(MatchJSON(`{
|
||||
|
@ -870,7 +870,7 @@ var _ = Describe("Workers API", func() {
|
|||
})
|
||||
|
||||
It("returns the validation error in the response body", func() {
|
||||
Expect(ioutil.ReadAll(response.Body)).To(Equal([]byte("malformed ttl")))
|
||||
Expect(io.ReadAll(response.Body)).To(Equal([]byte("malformed ttl")))
|
||||
})
|
||||
|
||||
It("does not heartbeat worker", func() {
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -540,7 +539,7 @@ func (cmd *RunCommand) Runner(positionalArguments []string) (ifrit.Runner, error
|
|||
atc.DefaultWebhookInterval = cmd.ResourceWithWebhookCheckingInterval
|
||||
|
||||
if cmd.BaseResourceTypeDefaults.Path() != "" {
|
||||
content, err := ioutil.ReadFile(cmd.BaseResourceTypeDefaults.Path())
|
||||
content, err := os.ReadFile(cmd.BaseResourceTypeDefaults.Path())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1300,7 +1299,7 @@ func (cmd *RunCommand) validateCustomRoles() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile(path)
|
||||
content, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open RBAC config file (%s): %w", cmd.ConfigRBAC, err)
|
||||
}
|
||||
|
@ -1338,7 +1337,7 @@ func (cmd *RunCommand) parseCustomRoles() (map[string]string, error) {
|
|||
return mapping, nil
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile(path)
|
||||
content, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1486,7 +1485,7 @@ func (cmd *RunCommand) tlsConfig(logger lager.Logger, dbConn db.Conn) (*tls.Conf
|
|||
|
||||
if cmd.isMTLSEnabled() {
|
||||
tlsLogger.Debug("mTLS-Enabled")
|
||||
clientCACert, err := ioutil.ReadFile(string(cmd.TLSCaCert))
|
||||
clientCACert, err := os.ReadFile(string(cmd.TLSCaCert))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package builds_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
util.PanicSink = ioutil.Discard
|
||||
util.PanicSink = io.Discard
|
||||
}
|
||||
|
||||
type TrackerSuite struct {
|
||||
|
|
|
@ -3,8 +3,8 @@ package credhub
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"code.cloudfoundry.org/credhub-cli/credhub"
|
||||
|
@ -60,7 +60,7 @@ func (manager *CredHubManager) Init(log lager.Logger) error {
|
|||
|
||||
caCerts := []string{}
|
||||
for _, cert := range manager.TLS.CACerts {
|
||||
contents, err := ioutil.ReadFile(cert)
|
||||
contents, err := os.ReadFile(cert)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package creds
|
|||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"text/template"
|
||||
"text/template/parse"
|
||||
)
|
||||
|
@ -53,7 +53,7 @@ func BuildSecretTemplate(name, tmpl string) (*SecretTemplate, error) {
|
|||
|
||||
// Validate that the template only consumes the expected keys
|
||||
dummy := struct{ Team, Pipeline, Secret string }{"team", "pipeline", "secret"}
|
||||
if err = t.Execute(ioutil.Discard, &dummy); err != nil {
|
||||
if err = t.Execute(io.Discard, &dummy); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ func BuildSecretTemplate(name, tmpl string) (*SecretTemplate, error) {
|
|||
// should only be expanded when there is a pipeline context
|
||||
pipelineDependent := false
|
||||
dummyNoPipeline := struct{ Team, Secret string }{"team", "secret"}
|
||||
if t.Execute(ioutil.Discard, &dummyNoPipeline) != nil {
|
||||
if t.Execute(io.Discard, &dummyNoPipeline) != nil {
|
||||
pipelineDependent = true
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package vault
|
|||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
@ -272,7 +272,7 @@ func (ac *APIClient) configureTLS(config *tls.Config) error {
|
|||
}
|
||||
|
||||
if ac.tlsConfig.ClientCertFile != "" {
|
||||
content, err := ioutil.ReadFile(ac.tlsConfig.ClientCertFile)
|
||||
content, err := os.ReadFile(ac.tlsConfig.ClientCertFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ func (ac *APIClient) configureTLS(config *tls.Config) error {
|
|||
}
|
||||
|
||||
if ac.tlsConfig.ClientKeyFile != "" {
|
||||
content, err := ioutil.ReadFile(ac.tlsConfig.ClientKeyFile)
|
||||
content, err := os.ReadFile(ac.tlsConfig.ClientKeyFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package cli
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"text/template"
|
||||
|
@ -58,11 +57,11 @@ func (c *GenerateCommand) GenerateSQLMigration() error {
|
|||
|
||||
contents := ""
|
||||
|
||||
err := ioutil.WriteFile(path.Join(c.MigrationDirectory, upMigrationFileName), []byte(contents), 0644)
|
||||
err := os.WriteFile(path.Join(c.MigrationDirectory, upMigrationFileName), []byte(contents), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(path.Join(c.MigrationDirectory, downMigrationFileName), []byte(contents), 0644)
|
||||
err = os.WriteFile(path.Join(c.MigrationDirectory, downMigrationFileName), []byte(contents), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cli_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
|
@ -23,7 +22,7 @@ var _ = Describe("Migration CLI", func() {
|
|||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
migrationDir, err = ioutil.TempDir("", "")
|
||||
migrationDir, err = os.MkdirTemp("", "")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
})
|
||||
|
@ -77,7 +76,7 @@ var _ = Describe("Migration CLI", func() {
|
|||
func ExpectGeneratedFilesToMatchSpecification(migrationDir, fileNamePattern, migrationName string,
|
||||
checkContents func(migrationID string, actualFileContents string)) {
|
||||
|
||||
files, err := ioutil.ReadDir(migrationDir)
|
||||
files, err := os.ReadDir(migrationDir)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
var migrationFilesCount = 0
|
||||
regex := regexp.MustCompile(fileNamePattern)
|
||||
|
@ -90,7 +89,7 @@ func ExpectGeneratedFilesToMatchSpecification(migrationDir, fileNamePattern, mig
|
|||
Expect(matches).To(HaveLen(4))
|
||||
Expect(matches[2]).To(Equal(migrationName))
|
||||
|
||||
fileContents, err := ioutil.ReadFile(path.Join(migrationDir, migrationFileName))
|
||||
fileContents, err := os.ReadFile(path.Join(migrationDir, migrationFileName))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
checkContents(matches[1], string(fileContents))
|
||||
migrationFilesCount++
|
||||
|
|
|
@ -3,7 +3,6 @@ package migration_test
|
|||
import (
|
||||
"database/sql"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -561,7 +560,7 @@ func SetupSchemaMigrationsTable(db *sql.DB, version int, dirty bool) {
|
|||
}
|
||||
|
||||
func SetupSchemaFromFile(db *sql.DB, path string) {
|
||||
migrations, err := ioutil.ReadFile(path)
|
||||
migrations, err := os.ReadFile(path)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
for _, migration := range strings.Split(string(migrations), ";") {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
@ -149,7 +149,7 @@ func (step *LoadVarStep) fetchVars(
|
|||
|
||||
defer stream.Close()
|
||||
|
||||
fileContent, err := ioutil.ReadAll(stream)
|
||||
fileContent, err := io.ReadAll(stream)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
|
@ -333,7 +332,7 @@ func (s setPipelineSource) fetchPipelineBits(path string) ([]byte, error) {
|
|||
}
|
||||
defer stream.Close()
|
||||
|
||||
byteConfig, err := ioutil.ReadAll(stream)
|
||||
byteConfig, err := io.ReadAll(stream)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package exec
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
|
@ -88,7 +88,7 @@ func (configSource FileConfigSource) FetchConfig(ctx context.Context, logger lag
|
|||
|
||||
defer stream.Close()
|
||||
|
||||
byteConfig, err := ioutil.ReadAll(stream)
|
||||
byteConfig, err := io.ReadAll(stream)
|
||||
if err != nil {
|
||||
return atc.TaskConfig{}, err
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package integration_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -151,7 +150,7 @@ jobs:
|
|||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
tmp, err = ioutil.TempDir("", fmt.Sprintf("tmp-%d", GinkgoParallelProcess()))
|
||||
tmp, err = os.MkdirTemp("", fmt.Sprintf("tmp-%d", GinkgoParallelProcess()))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
|
@ -171,7 +170,7 @@ viewer:
|
|||
|
||||
It("errors", func() {
|
||||
file := filepath.Join(tmp, "rbac-not-action.yml")
|
||||
err := ioutil.WriteFile(file, []byte(rbac), 0755)
|
||||
err := os.WriteFile(file, []byte(rbac), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
cmd.ConfigRBAC = flag.File(file)
|
||||
|
@ -195,7 +194,7 @@ not-viewer:
|
|||
|
||||
It("errors", func() {
|
||||
file := filepath.Join(tmp, "rbac-not-role.yml")
|
||||
err := ioutil.WriteFile(file, []byte(rbac), 0755)
|
||||
err := os.WriteFile(file, []byte(rbac), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
cmd.ConfigRBAC = flag.File(file)
|
||||
|
@ -216,7 +215,7 @@ viewer:
|
|||
- SaveConfig
|
||||
`
|
||||
file := filepath.Join(tmp, "rbac.yml")
|
||||
err := ioutil.WriteFile(file, []byte(rbac), 0755)
|
||||
err := os.WriteFile(file, []byte(rbac), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
cmd.ConfigRBAC = flag.File(file)
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -222,7 +221,7 @@ func (emitter *NewRelicEmitter) emitBatch(logger lager.Logger, payload []NewReli
|
|||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||
bodyBytes, err := ioutil.ReadAll(resp.Body)
|
||||
bodyBytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
logger.Info("failed-to-read-response-body",
|
||||
lager.Data{"error": err.Error(), "status-code": resp.StatusCode})
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -173,10 +173,10 @@ func verifyEvents(expectedEvents int) http.HandlerFunc {
|
|||
if request.Header.Get("Content-Encoding") == "gzip" {
|
||||
reader, err := gzip.NewReader(request.Body)
|
||||
Expect(err).To(Not(HaveOccurred()))
|
||||
givenBody, err = ioutil.ReadAll(reader)
|
||||
givenBody, err = io.ReadAll(reader)
|
||||
Expect(err).To(Not(HaveOccurred()))
|
||||
} else {
|
||||
givenBody, err = ioutil.ReadAll(request.Body)
|
||||
givenBody, err = io.ReadAll(request.Body)
|
||||
Expect(err).To(Not(HaveOccurred()))
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package emitter_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
|
@ -211,7 +211,7 @@ var _ = Describe("PrometheusEmitter", func() {
|
|||
})
|
||||
|
||||
res, _ := http.Get(fmt.Sprintf("http://%s:%s/metrics", prometheusConfig.BindIP, prometheusConfig.BindPort))
|
||||
body, _ := ioutil.ReadAll(res.Body)
|
||||
body, _ := io.ReadAll(res.Body)
|
||||
defer res.Body.Close()
|
||||
Expect(res.StatusCode).To(Equal(http.StatusOK))
|
||||
Expect(string(body)).To(ContainSubstring("concourse_steps_waiting{invalid_label=\"foo\",platform=\"darwin\",prefix_test=\"bar\",prefix_testtwo=\"baz\",teamId=\"42\",teamName=\"teamdev\",type=\"get\",workerTags=\"tester\"} 4"))
|
||||
|
|
|
@ -3,7 +3,6 @@ package atc
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -27,7 +26,7 @@ func (path *PathFlag) UnmarshalFlag(value string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
tempf, err := ioutil.TempFile("", tempFilePattern)
|
||||
tempf, err := os.CreateTemp("", tempFilePattern)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create a temp file")
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -69,7 +69,7 @@ func (c opa) Check(input policy.PolicyCheckInput) (policy.PolicyCheckResult, err
|
|||
return nil, fmt.Errorf("opa returned status: %d", statusCode)
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("opa returned no response: %s", err.Error())
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package postgresrunner
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
|
@ -33,7 +32,7 @@ func (runner Runner) Run(signals <-chan os.Signal, ready chan<- struct{}) error
|
|||
err := os.MkdirAll(pgBase, 0755)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
tmpdir, err := ioutil.TempDir(pgBase, "postgres")
|
||||
tmpdir, err := os.MkdirTemp(pgBase, "postgres")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
currentUser, err := user.Current()
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -36,7 +36,7 @@ func Dial(transport, address string, caCerts []string) (*Syslog, error) {
|
|||
}
|
||||
|
||||
for _, cert := range caCerts {
|
||||
content, err := ioutil.ReadFile(cert)
|
||||
content, err := os.ReadFile(cert)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package syslog_test
|
|||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
|
@ -55,7 +54,7 @@ var _ = Describe("Syslog", func() {
|
|||
tlsCert, err := tls.X509KeyPair(certPEM, keyPEM)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
caFile, err := ioutil.TempFile("", "ca")
|
||||
caFile, err := os.CreateTemp("", "ca")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
_, err = caFile.Write(caPEM)
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
|
@ -81,7 +80,7 @@ func (h *hijackable) Hijack(ctx context.Context, handler string, body io.Reader,
|
|||
if httpResp.StatusCode < 200 || httpResp.StatusCode > 299 {
|
||||
defer httpResp.Body.Close()
|
||||
|
||||
errRespBytes, err := ioutil.ReadAll(httpResp.Body)
|
||||
errRespBytes, err := io.ReadAll(httpResp.Body)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("backend error: Exit status: %d, Body: %s, error reading response body: %s", httpResp.StatusCode, string(errRespBytes), err)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -849,7 +848,7 @@ var _ = Describe("Connection", func() {
|
|||
ghttp.CombineHandlers(
|
||||
ghttp.VerifyRequest("PUT", "/containers/foo-handle/files", "user=alice&destination=%2Fbar"),
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
body, err := io.ReadAll(r.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(string(body)).To(Equal("chunk-1chunk-2"))
|
||||
|
@ -926,7 +925,7 @@ var _ = Describe("Connection", func() {
|
|||
reader, err := connection.StreamOut("foo-handle", garden.StreamOutSpec{User: "frank", Path: "/bar"})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
readBytes, err := ioutil.ReadAll(reader)
|
||||
readBytes, err := io.ReadAll(reader)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(readBytes).To(Equal([]byte("hello-world!")))
|
||||
|
||||
|
@ -950,7 +949,7 @@ var _ = Describe("Connection", func() {
|
|||
reader, err := connection.StreamOut("foo-handle", garden.StreamOutSpec{User: "deandra", Path: "/bar"})
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = ioutil.ReadAll(reader)
|
||||
_, err = io.ReadAll(reader)
|
||||
reader.Close()
|
||||
Expect(err).To(HaveOccurred())
|
||||
})
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -163,7 +163,7 @@ var _ = Describe("Container", func() {
|
|||
Ω(spec.Path).Should(Equal("to"))
|
||||
Ω(spec.User).Should(Equal("frank"))
|
||||
|
||||
content, err := ioutil.ReadAll(spec.TarStream)
|
||||
content, err := io.ReadAll(spec.TarStream)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(string(content)).Should(Equal("stuff"))
|
||||
|
||||
|
@ -197,14 +197,14 @@ var _ = Describe("Container", func() {
|
|||
|
||||
Describe("StreamOut", func() {
|
||||
It("sends a stream out request", func() {
|
||||
fakeConnection.StreamOutReturns(ioutil.NopCloser(strings.NewReader("kewl")), nil)
|
||||
fakeConnection.StreamOutReturns(io.NopCloser(strings.NewReader("kewl")), nil)
|
||||
|
||||
reader, err := container.StreamOut(garden.StreamOutSpec{
|
||||
User: "deandra",
|
||||
Path: "from",
|
||||
})
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
bytes, err := ioutil.ReadAll(reader)
|
||||
bytes, err := io.ReadAll(reader)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(string(bytes)).Should(Equal("kewl"))
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -100,7 +99,7 @@ func (h *WorkerHijackStreamer) Hijack(ctx context.Context, handler string, body
|
|||
defer hijackCloser.Close()
|
||||
defer httpResp.Body.Close()
|
||||
|
||||
errRespBytes, err := ioutil.ReadAll(httpResp.Body)
|
||||
errRespBytes, err := io.ReadAll(httpResp.Body)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("backend error: Exit status: %d, error reading response body: %s", httpResp.StatusCode, err)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -97,11 +96,11 @@ var _ = Describe("hijackStreamer", func() {
|
|||
|
||||
Context("when httpResponse is success", func() {
|
||||
BeforeEach(func() {
|
||||
httpResp = http.Response{StatusCode: http.StatusOK, Body: ioutil.NopCloser(body)}
|
||||
httpResp = http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(body)}
|
||||
})
|
||||
|
||||
It("returns response body", func() {
|
||||
actualBodyBytes, err := ioutil.ReadAll(actualReadCloser)
|
||||
actualBodyBytes, err := io.ReadAll(actualReadCloser)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(expectedString).To(Equal(string(actualBodyBytes)))
|
||||
})
|
||||
|
@ -154,7 +153,7 @@ var _ = Describe("hijackStreamer", func() {
|
|||
|
||||
Context("when httpResponse fails", func() {
|
||||
BeforeEach(func() {
|
||||
httpResp = http.Response{StatusCode: http.StatusTeapot, Body: ioutil.NopCloser(body)}
|
||||
httpResp = http.Response{StatusCode: http.StatusTeapot, Body: io.NopCloser(body)}
|
||||
})
|
||||
|
||||
It("returns error", func() {
|
||||
|
@ -181,7 +180,7 @@ var _ = Describe("hijackStreamer", func() {
|
|||
Expect(actualRequest.URL).To(Equal(expectedRequest.URL))
|
||||
Expect(actualRequest.Header).To(Equal(expectedRequest.Header))
|
||||
|
||||
s, err := ioutil.ReadAll(actualRequest.Body)
|
||||
s, err := io.ReadAll(actualRequest.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(s)).To(Equal("some-request-body"))
|
||||
})
|
||||
|
@ -306,7 +305,7 @@ var _ = Describe("hijackStreamer", func() {
|
|||
Context("when httpResponse fails", func() {
|
||||
BeforeEach(func() {
|
||||
fakeHijackableClient.DoReturns(nil, nil, errors.New("Request failed"))
|
||||
httpResp = http.Response{StatusCode: http.StatusTeapot, Body: ioutil.NopCloser(body)}
|
||||
httpResp = http.Response{StatusCode: http.StatusTeapot, Body: io.NopCloser(body)}
|
||||
})
|
||||
|
||||
It("returns error", func() {
|
||||
|
@ -327,7 +326,7 @@ var _ = Describe("hijackStreamer", func() {
|
|||
Expect(actualRequest.URL).To(Equal(expectedRequest.URL))
|
||||
Expect(actualRequest.Header).To(Equal(expectedRequest.Header))
|
||||
|
||||
s, err := ioutil.ReadAll(actualRequest.Body)
|
||||
s, err := io.ReadAll(actualRequest.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(s)).To(Equal("some-request-body"))
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ package worker_test
|
|||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/concourse/concourse/atc"
|
||||
|
@ -233,7 +233,7 @@ var _ = Describe("Streamer", func() {
|
|||
|
||||
defer stream.Close()
|
||||
|
||||
fileContent, err := ioutil.ReadAll(stream)
|
||||
fileContent, err := io.ReadAll(stream)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(fileContent).To(Equal([]byte("content 2")))
|
||||
|
@ -256,7 +256,7 @@ var _ = Describe("Streamer", func() {
|
|||
|
||||
defer stream.Close()
|
||||
|
||||
fileContent, err := ioutil.ReadAll(stream)
|
||||
fileContent, err := io.ReadAll(stream)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Expect(fileContent).To(Equal([]byte("content 2")))
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"crypto/rsa"
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -166,7 +165,7 @@ var _ = Describe("Web Command", func() {
|
|||
})
|
||||
|
||||
func generateSSHKeypair() (string, string, *rsa.PrivateKey, ssh.PublicKey) {
|
||||
path, err := ioutil.TempDir("", "tsa-key")
|
||||
path, err := os.MkdirTemp("", "tsa-key")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
privateKeyPath := filepath.Join(path, "id_rsa")
|
||||
|
@ -186,10 +185,10 @@ func generateSSHKeypair() (string, string, *rsa.PrivateKey, ssh.PublicKey) {
|
|||
|
||||
publicKeyBytes := ssh.MarshalAuthorizedKey(publicKeyRsa)
|
||||
|
||||
err = ioutil.WriteFile(privateKeyPath, privateKeyBytes, 0600)
|
||||
err = os.WriteFile(privateKeyPath, privateKeyBytes, 0600)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(publicKeyPath, publicKeyBytes, 0600)
|
||||
err = os.WriteFile(publicKeyPath, publicKeyBytes, 0600)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
return privateKeyPath, publicKeyPath, privateKey, publicKeyRsa
|
||||
|
|
|
@ -2,7 +2,6 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
|
@ -19,7 +18,7 @@ type FormatPipelineCommand struct {
|
|||
|
||||
func (command *FormatPipelineCommand) Execute(args []string) error {
|
||||
configPath := string(command.Config)
|
||||
configBytes, err := ioutil.ReadFile(configPath)
|
||||
configBytes, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
displayhelpers.FailWithErrorf("could not read config file", err)
|
||||
}
|
||||
|
@ -46,7 +45,7 @@ func (command *FormatPipelineCommand) Execute(args []string) error {
|
|||
displayhelpers.FailWithErrorf("could not stat config file", err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(configPath, unwrappedConfigBytes, fi.Mode())
|
||||
err = os.WriteFile(configPath, unwrappedConfigBytes, fi.Mode())
|
||||
if err != nil {
|
||||
displayhelpers.FailWithErrorf("could not write formatted config to %s", err, command.Config)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package templatehelpers
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/concourse/concourse/atc"
|
||||
"github.com/concourse/concourse/fly/commands/internal/flaghelpers"
|
||||
|
@ -38,7 +38,7 @@ func (yamlTemplate YamlTemplateWithParams) Evaluate(
|
|||
allowEmpty bool,
|
||||
strict bool,
|
||||
) ([]byte, error) {
|
||||
config, err := ioutil.ReadFile(string(yamlTemplate.filePath))
|
||||
config, err := os.ReadFile(string(yamlTemplate.filePath))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not read file: %s", err.Error())
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ func (yamlTemplate YamlTemplateWithParams) Evaluate(
|
|||
// same values in the files specified earlier on command line
|
||||
for i := len(yamlTemplate.templateVariablesFiles) - 1; i >= 0; i-- {
|
||||
path := yamlTemplate.templateVariablesFiles[i]
|
||||
templateVars, err := ioutil.ReadFile(string(path))
|
||||
templateVars, err := os.ReadFile(string(path))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not read template variables file (%s): %s", string(path), err.Error())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package templatehelpers_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
@ -23,10 +22,10 @@ var _ = Describe("YAML Template With Params", func() {
|
|||
BeforeEach(func() {
|
||||
var err error
|
||||
|
||||
tmpdir, err = ioutil.TempDir("", "yaml-template-test")
|
||||
tmpdir, err = os.MkdirTemp("", "yaml-template-test")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(tmpdir, "sample.yml"),
|
||||
[]byte(`section:
|
||||
- param1: ((param1))
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package validatepipelinehelpers_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
@ -25,10 +24,10 @@ var _ = Describe("Validate Pipeline", func() {
|
|||
BeforeEach(func() {
|
||||
var err error
|
||||
|
||||
tmpdir, err = ioutil.TempDir("", "validate-test")
|
||||
tmpdir, err = os.MkdirTemp("", "validate-test")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(tmpdir, "good-pipeline.yml"),
|
||||
[]byte(`---
|
||||
resource_types:
|
||||
|
@ -57,7 +56,7 @@ jobs:
|
|||
)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(tmpdir, "dupkey-pipeline.yml"),
|
||||
[]byte(`---
|
||||
resource_types:
|
||||
|
@ -91,7 +90,7 @@ resource_types:
|
|||
)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(tmpdir, "good-across-pipeline.yml"),
|
||||
[]byte(`---
|
||||
resource_types:
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -47,7 +46,7 @@ func (command *LoginCommand) Execute(args []string) error {
|
|||
|
||||
var caCert string
|
||||
if command.CACert != "" {
|
||||
caCertBytes, err := ioutil.ReadFile(string(command.CACert))
|
||||
caCertBytes, err := os.ReadFile(string(command.CACert))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -40,13 +40,13 @@ var _ = Describe("Fly CLI", func() {
|
|||
BeforeEach(func() {
|
||||
var err error
|
||||
|
||||
buildDir, err = ioutil.TempDir("", "fly-build-dir")
|
||||
buildDir, err = os.MkdirTemp("", "fly-build-dir")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
otherInputDir, err = ioutil.TempDir("", "fly-s3-asset-dir")
|
||||
otherInputDir, err = os.MkdirTemp("", "fly-s3-asset-dir")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -73,7 +73,7 @@ run:
|
|||
)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(otherInputDir, "s3-asset-file"),
|
||||
[]byte(`blob`),
|
||||
0644,
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
@ -38,13 +38,13 @@ var _ = Describe("Fly CLI", func() {
|
|||
BeforeEach(func() {
|
||||
var err error
|
||||
|
||||
buildDir, err = ioutil.TempDir("", "fly-build-dir")
|
||||
buildDir, err = os.MkdirTemp("", "fly-build-dir")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
otherInputDir, err = ioutil.TempDir("", "fly-s3-asset-dir")
|
||||
otherInputDir, err = os.MkdirTemp("", "fly-s3-asset-dir")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -71,7 +71,7 @@ run:
|
|||
)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(otherInputDir, "s3-asset-file"),
|
||||
[]byte(`blob`),
|
||||
0644,
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
@ -47,7 +46,7 @@ var _ = Describe("Fly CLI", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
tmpdir, err = ioutil.TempDir("", "fly-build-dir")
|
||||
tmpdir, err = os.MkdirTemp("", "fly-build-dir")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
buildDir = filepath.Join(tmpdir, "fixture")
|
||||
|
@ -57,7 +56,7 @@ var _ = Describe("Fly CLI", func() {
|
|||
|
||||
taskConfigPath = filepath.Join(buildDir, "task.yml")
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
taskConfigPath,
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -357,7 +356,7 @@ run:
|
|||
Context("when the build config is invalid", func() {
|
||||
BeforeEach(func() {
|
||||
// missing platform and run path
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
run: {}
|
||||
|
@ -418,7 +417,7 @@ run: {}
|
|||
var bardir string
|
||||
|
||||
BeforeEach(func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -497,7 +496,7 @@ run:
|
|||
|
||||
Context("when the current directory name is not the same as the missing input", func() {
|
||||
BeforeEach(func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -582,11 +581,11 @@ run:
|
|||
BeforeEach(func() {
|
||||
gitIgnorePath := filepath.Join(buildDir, ".gitignore")
|
||||
|
||||
err := ioutil.WriteFile(gitIgnorePath, []byte(`*.test`), 0644)
|
||||
err := os.WriteFile(gitIgnorePath, []byte(`*.test`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
fileToBeIgnoredPath := filepath.Join(buildDir, "dev.test")
|
||||
err = ioutil.WriteFile(fileToBeIgnoredPath, []byte(`test file content`), 0644)
|
||||
err = os.WriteFile(fileToBeIgnoredPath, []byte(`test file content`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = os.Mkdir(filepath.Join(buildDir, ".git"), 0755)
|
||||
|
@ -599,7 +598,7 @@ run:
|
|||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
gitHEADPath := filepath.Join(buildDir, ".git/HEAD")
|
||||
err = ioutil.WriteFile(gitHEADPath, []byte(`ref: refs/heads/master`), 0644)
|
||||
err = os.WriteFile(gitHEADPath, []byte(`ref: refs/heads/master`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
|
@ -769,7 +768,7 @@ run:
|
|||
Context("when input is not a folder", func() {
|
||||
It("prints an error", func() {
|
||||
testFile := filepath.Join(buildDir, "test-file.txt")
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
testFile,
|
||||
[]byte(`test file content`),
|
||||
0644,
|
||||
|
@ -807,7 +806,7 @@ run:
|
|||
|
||||
Context("when the task specifies no input", func() {
|
||||
BeforeEach(func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -863,7 +862,7 @@ run:
|
|||
|
||||
Context("when the task specifies an optional input", func() {
|
||||
BeforeEach(func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -954,7 +953,7 @@ run:
|
|||
|
||||
Context("when the task specifies more than one required input", func() {
|
||||
BeforeEach(func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(buildDir, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"compress/gzip"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -39,10 +38,10 @@ var _ = Describe("Fly CLI", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
tmpdir, err = ioutil.TempDir("", "fly-build-dir")
|
||||
tmpdir, err = os.MkdirTemp("", "fly-build-dir")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
outputDir, err = ioutil.TempDir("", "fly-task-output")
|
||||
outputDir, err = os.MkdirTemp("", "fly-task-output")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
buildDir = filepath.Join(tmpdir, "fixture")
|
||||
|
@ -52,7 +51,7 @@ var _ = Describe("Fly CLI", func() {
|
|||
|
||||
taskConfigPath = filepath.Join(buildDir, "task.yml")
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
taskConfigPath,
|
||||
[]byte(`---
|
||||
platform: some-platform
|
||||
|
@ -250,13 +249,13 @@ run:
|
|||
<-sess.Exited
|
||||
Expect(sess.ExitCode()).To(Equal(0))
|
||||
|
||||
outputFiles, err := ioutil.ReadDir(outputDir)
|
||||
outputFiles, err := os.ReadDir(outputDir)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(outputFiles).To(HaveLen(1))
|
||||
Expect(outputFiles[0].Name()).To(Equal("some-file"))
|
||||
|
||||
data, err := ioutil.ReadFile(filepath.Join(outputDir, outputFiles[0].Name()))
|
||||
data, err := os.ReadFile(filepath.Join(outputDir, outputFiles[0].Name()))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(data).To(Equal([]byte("tar-contents")))
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package integration_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
|
@ -21,13 +20,13 @@ var _ = Describe("Fly CLI", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
configFile, err = ioutil.TempFile("", "format-pipeline-test-*.yml")
|
||||
configFile, err = os.CreateTemp("", "format-pipeline-test-*.yml")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
inputYaml, err = ioutil.ReadFile("fixtures/format-input.yml")
|
||||
inputYaml, err = os.ReadFile("fixtures/format-input.yml")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
expectedYaml, err = ioutil.ReadFile("fixtures/format-expected.yml")
|
||||
expectedYaml, err = os.ReadFile("fixtures/format-expected.yml")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
_, err = configFile.Write(inputYaml)
|
||||
|
@ -78,7 +77,7 @@ var _ = Describe("Fly CLI", func() {
|
|||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(newFileInfo.ModTime()).To(Equal(oldFileInfo.ModTime()))
|
||||
|
||||
newYaml, err := ioutil.ReadFile(configFile.Name())
|
||||
newYaml, err := os.ReadFile(configFile.Name())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(newYaml).To(Equal(inputYaml))
|
||||
})
|
||||
|
@ -98,7 +97,7 @@ var _ = Describe("Fly CLI", func() {
|
|||
<-sess.Exited
|
||||
Expect(sess.ExitCode()).To(Equal(0))
|
||||
|
||||
newYaml, err := ioutil.ReadFile(configFile.Name())
|
||||
newYaml, err := os.ReadFile(configFile.Name())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(newYaml).To(MatchYAML(expectedYaml))
|
||||
})
|
||||
|
@ -117,7 +116,7 @@ var _ = Describe("Fly CLI", func() {
|
|||
<-sess.Exited
|
||||
Expect(sess.ExitCode()).To(Equal(0))
|
||||
|
||||
firstPassYaml, err := ioutil.ReadFile(configFile.Name())
|
||||
firstPassYaml, err := os.ReadFile(configFile.Name())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
flyCmd2 := exec.Command(
|
||||
|
@ -133,7 +132,7 @@ var _ = Describe("Fly CLI", func() {
|
|||
<-sess2.Exited
|
||||
Expect(sess2.ExitCode()).To(Equal(0))
|
||||
|
||||
secondPassYaml, err := ioutil.ReadFile(configFile.Name())
|
||||
secondPassYaml, err := os.ReadFile(configFile.Name())
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(firstPassYaml).To(MatchYAML(secondPassYaml))
|
||||
|
|
|
@ -3,8 +3,8 @@ package integration_test
|
|||
import (
|
||||
"encoding/pem"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
|
@ -149,7 +149,7 @@ var _ = Describe("login -k Command", func() {
|
|||
Bytes: loginATCServer.HTTPTestServer.TLS.Certificates[0].Certificate[0],
|
||||
}))
|
||||
|
||||
caCertFile, err := ioutil.TempFile("", "ca_cert.pem")
|
||||
caCertFile, err := os.CreateTemp("", "ca_cert.pem")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
_, err = caCertFile.WriteString(sslCert)
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -261,11 +260,11 @@ var _ = Describe("login Command", func() {
|
|||
userInfoHandler(),
|
||||
)
|
||||
|
||||
caCertFile, err := ioutil.TempFile("", "fly-login-test")
|
||||
caCertFile, err := os.CreateTemp("", "fly-login-test")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
caCertFilePath = caCertFile.Name()
|
||||
|
||||
err = ioutil.WriteFile(caCertFilePath, []byte(serverCert), os.ModePerm)
|
||||
err = os.WriteFile(caCertFilePath, []byte(serverCert), os.ModePerm)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
setupFlyCmd := exec.Command(flyPath, "-t", "some-target", "login", "-c", loginATCServer.URL(), "-n", "some-team", "--ca-cert", caCertFilePath, "-u", "user", "-p", "pass")
|
||||
|
@ -529,7 +528,7 @@ var _ = Describe("login Command", func() {
|
|||
})
|
||||
|
||||
It("flyrc is backwards-compatible with pre-v5.4.0", func() {
|
||||
flyRcContents, err := ioutil.ReadFile(homeDir + "/.flyrc")
|
||||
flyRcContents, err := os.ReadFile(homeDir + "/.flyrc")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(string(flyRcContents)).To(HavePrefix("targets:"))
|
||||
})
|
||||
|
|
|
@ -3,7 +3,6 @@ package integration_test
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -784,7 +783,7 @@ this is super secure
|
|||
BeforeEach(func() {
|
||||
var err error
|
||||
|
||||
configFile, err = ioutil.TempFile("", "fly-config-file")
|
||||
configFile, err = os.CreateTemp("", "fly-config-file")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
changedConfig = config
|
||||
|
@ -1533,7 +1532,7 @@ this is super secure
|
|||
|
||||
func getConfig(r *http.Request) []byte {
|
||||
defer r.Body.Close()
|
||||
payload, err := ioutil.ReadAll(r.Body)
|
||||
payload, err := io.ReadAll(r.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
return payload
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -17,11 +16,11 @@ import (
|
|||
"github.com/concourse/concourse/atc/db"
|
||||
"github.com/concourse/concourse/fly/rc"
|
||||
"github.com/concourse/concourse/skymarshal/token"
|
||||
"github.com/go-jose/go-jose/v3/jwt"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/onsi/gomega/gexec"
|
||||
"github.com/onsi/gomega/ghttp"
|
||||
"github.com/go-jose/go-jose/v3/jwt"
|
||||
)
|
||||
|
||||
var flyPath string
|
||||
|
@ -122,7 +121,7 @@ func createFlyRc(targets rc.Targets) {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(flyrc, flyrcBytes, 0600)
|
||||
err = os.WriteFile(flyrc, flyrcBytes, 0600)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -140,7 +139,7 @@ var _ = BeforeEach(func() {
|
|||
|
||||
var err error
|
||||
|
||||
homeDir, err = ioutil.TempDir("", "fly-test")
|
||||
homeDir, err = os.MkdirTemp("", "fly-test")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
os.Setenv("HOME", homeDir)
|
||||
|
|
|
@ -3,7 +3,6 @@ package integration_test
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -28,7 +27,7 @@ var _ = Describe("Syncing", func() {
|
|||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
copiedFlyDir, err := ioutil.TempDir("", "fly_sync")
|
||||
copiedFlyDir, err := os.MkdirTemp("", "fly_sync")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
copiedFly, err := os.Create(filepath.Join(copiedFlyDir, filepath.Base(flyPath)))
|
||||
|
@ -160,13 +159,13 @@ var _ = Describe("Syncing", func() {
|
|||
})
|
||||
|
||||
func readBinary(path string) []byte {
|
||||
expectedBinary, err := ioutil.ReadFile(flyPath)
|
||||
expectedBinary, err := os.ReadFile(flyPath)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
return expectedBinary[:8]
|
||||
}
|
||||
|
||||
func expectBinaryToMatch(path string, expectedBinary []byte) {
|
||||
contents, err := ioutil.ReadFile(path)
|
||||
contents, err := os.ReadFile(path)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
// don't let ginkgo try and output the entire binary as ascii
|
||||
|
|
|
@ -3,7 +3,6 @@ package rc_test
|
|||
import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -95,7 +94,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
tmpDir, err = ioutil.TempDir("", "fly-test")
|
||||
tmpDir, err = os.MkdirTemp("", "fly-test")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
os.Setenv("HOME", tmpDir)
|
||||
|
@ -114,7 +113,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
some-target-a: {}
|
||||
another-target: {}
|
||||
`
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -140,7 +139,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
token:
|
||||
type: Bearer
|
||||
value: some-token`
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
It("loads target with correct transport", func() {
|
||||
|
@ -180,7 +179,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
flyrcContents, err := yaml.Marshal(flyrcConfig)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
It("loads target with correct transport", func() {
|
||||
|
@ -214,11 +213,11 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
certPath := filepath.Join(userHomeDir(), "client.pem")
|
||||
keyPath := filepath.Join(userHomeDir(), "client.key")
|
||||
|
||||
err := ioutil.WriteFile(certPath, []byte(clientCert), 0600)
|
||||
err := os.WriteFile(certPath, []byte(clientCert), 0600)
|
||||
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(keyPath, []byte(clientKey), 0600)
|
||||
err = os.WriteFile(keyPath, []byte(clientKey), 0600)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
flyrcConfig := rc.RC{
|
||||
|
@ -238,7 +237,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
flyrcContents, err := yaml.Marshal(flyrcConfig)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
It("loads target with correct transport", func() {
|
||||
|
@ -262,7 +261,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
BeforeEach(func() {
|
||||
certPath := filepath.Join(userHomeDir(), "client.pem")
|
||||
|
||||
err := ioutil.WriteFile(certPath, []byte(clientCert), 0600)
|
||||
err := os.WriteFile(certPath, []byte(clientCert), 0600)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
flyrcConfig := rc.RC{
|
||||
|
@ -281,7 +280,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
flyrcContents, err := yaml.Marshal(flyrcConfig)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
It("warns the user and exits with failure", func() {
|
||||
|
@ -294,7 +293,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
BeforeEach(func() {
|
||||
keyPath := filepath.Join(userHomeDir(), "client.key")
|
||||
|
||||
err := ioutil.WriteFile(keyPath, []byte(clientKey), 0600)
|
||||
err := os.WriteFile(keyPath, []byte(clientKey), 0600)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
flyrcConfig := rc.RC{
|
||||
|
@ -313,7 +312,7 @@ Lfkzl8ebb+tt0XFMUFc42WNr
|
|||
flyrcContents, err := yaml.Marshal(flyrcConfig)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
It("warns the user and exits with failure", func() {
|
||||
|
|
|
@ -3,7 +3,6 @@ package rc
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
@ -192,7 +191,7 @@ func LoadTargets() (Targets, error) {
|
|||
|
||||
flyrc := flyrcPath()
|
||||
if _, err := os.Stat(flyrc); err == nil {
|
||||
flyTargetsBytes, err := ioutil.ReadFile(flyrc)
|
||||
flyTargetsBytes, err := os.ReadFile(flyrc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -223,7 +222,7 @@ func writeTargets(configFileLocation string, targetsToWrite Targets) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(configFileLocation, yamlBytes, os.FileMode(0600))
|
||||
err = os.WriteFile(configFileLocation, yamlBytes, os.FileMode(0600))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package rc_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
@ -18,7 +17,7 @@ var _ = Describe("Targets", func() {
|
|||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
tmpDir, err = ioutil.TempDir("", "fly-test")
|
||||
tmpDir, err = os.MkdirTemp("", "fly-test")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
os.Setenv("HOME", tmpDir)
|
||||
|
@ -39,7 +38,7 @@ var _ = Describe("Targets", func() {
|
|||
token:
|
||||
type: Bearer
|
||||
value: some-token`
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
It("loads target with default team", func() {
|
||||
|
@ -64,7 +63,7 @@ var _ = Describe("Targets", func() {
|
|||
some-target:
|
||||
api: http://concourse.com
|
||||
team: main`
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
@ -113,7 +112,7 @@ var _ = Describe("Targets", func() {
|
|||
token:
|
||||
type: Bearer
|
||||
value: some-other-token`
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
Describe("DeleteTarget", func() {
|
||||
Context("when provided with target name to delete", func() {
|
||||
|
@ -160,7 +159,7 @@ var _ = Describe("Targets", func() {
|
|||
token:
|
||||
type: Bearer
|
||||
value: some-token`
|
||||
ioutil.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
os.WriteFile(flyrc, []byte(flyrcContents), 0777)
|
||||
})
|
||||
Context("when props are provided for update", func() {
|
||||
It("should update target to specified prop attributes", func() {
|
||||
|
@ -225,7 +224,7 @@ var _ = Describe("Targets", func() {
|
|||
|
||||
Describe("when the file exists with 0755 permissions", func() {
|
||||
BeforeEach(func() {
|
||||
err := ioutil.WriteFile(flyrc, []byte{}, 0755)
|
||||
err := os.WriteFile(flyrc, []byte{}, 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package concourse_test
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/concourse/concourse/atc"
|
||||
|
@ -82,7 +82,7 @@ var _ = Describe("ArtifactRepository", func() {
|
|||
It("returns the contents", func() {
|
||||
contents, err := team.GetArtifact(17)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(ioutil.ReadAll(contents)).To(Equal([]byte("some-other-contents")))
|
||||
Expect(io.ReadAll(contents)).To(Equal([]byte("some-other-contents")))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package concourse_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
|
@ -39,7 +39,7 @@ var _ = Describe("ATC Handler CLI", func() {
|
|||
It("returns an unclosed io.ReaderCloser", func() {
|
||||
readerCloser, _, err := client.GetCLIReader(expectedArch, expectedPlatform)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(ioutil.ReadAll(readerCloser)).To(Equal([]byte("sup")))
|
||||
Expect(io.ReadAll(readerCloser)).To(Equal([]byte("sup")))
|
||||
})
|
||||
|
||||
It("returns response Headers", func() {
|
||||
|
|
|
@ -3,7 +3,7 @@ package concourse
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
|
@ -81,7 +81,7 @@ func (team *team) CreateOrUpdatePipelineConfig(pipelineRef atc.PipelineRef, conf
|
|||
}
|
||||
|
||||
defer response.Body.Close()
|
||||
body, _ := ioutil.ReadAll(response.Body)
|
||||
body, _ := io.ReadAll(response.Body)
|
||||
|
||||
switch response.StatusCode {
|
||||
case http.StatusOK, http.StatusCreated:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package concourse_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"sigs.k8s.io/yaml"
|
||||
|
@ -194,7 +194,7 @@ var _ = Describe("ATC Handler Configs", func() {
|
|||
ghttp.VerifyHeaderKV(atc.ConfigVersionHeader, "42"),
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
bodyConfig, err := ioutil.ReadAll(r.Body)
|
||||
bodyConfig, err := io.ReadAll(r.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
receivedConfig := []byte("")
|
||||
|
|
|
@ -3,7 +3,6 @@ package internal
|
|||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
|
@ -209,7 +208,7 @@ func (connection *connection) populateResponse(response *http.Response, returnRe
|
|||
}
|
||||
|
||||
if response.StatusCode < 200 || response.StatusCode >= 300 {
|
||||
body, _ := ioutil.ReadAll(response.Body)
|
||||
body, _ := io.ReadAll(response.Body)
|
||||
|
||||
return UnexpectedResponseError{
|
||||
StatusCode: response.StatusCode,
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/concourse/concourse/atc"
|
||||
|
@ -68,10 +68,10 @@ func (team *team) OrderingPipelines(pipelineNames []string) error {
|
|||
case http.StatusForbidden:
|
||||
return fmt.Errorf("you do not have a role on team '%s'", team.Name())
|
||||
case http.StatusBadRequest:
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return fmt.Errorf(string(body))
|
||||
default:
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return internal.UnexpectedResponseError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Status: resp.Status,
|
||||
|
@ -112,10 +112,10 @@ func (team *team) OrderingPipelinesWithinGroup(groupName string, instanceVars []
|
|||
case http.StatusForbidden:
|
||||
return fmt.Errorf("you do not have a role on team '%s'", team.Name())
|
||||
case http.StatusBadRequest:
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return fmt.Errorf(string(body))
|
||||
default:
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return internal.UnexpectedResponseError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Status: resp.Status,
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/concourse/concourse/atc"
|
||||
|
@ -146,7 +146,7 @@ func (client *client) FindTeam(teamName string) (Team, error) {
|
|||
case http.StatusNotFound:
|
||||
return nil, fmt.Errorf("team '%s' does not exist", teamName)
|
||||
default:
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return nil, internal.UnexpectedResponseError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Status: resp.Status,
|
||||
|
|
|
@ -2,7 +2,7 @@ package concourse
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/concourse/concourse/atc"
|
||||
|
@ -30,7 +30,7 @@ func (client *client) UserInfo() (atc.UserInfo, error) {
|
|||
case http.StatusUnauthorized:
|
||||
return atc.UserInfo{}, ErrUnauthorized
|
||||
default:
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return atc.UserInfo{}, internal.UnexpectedResponseError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Status: resp.Status,
|
||||
|
|
|
@ -2,7 +2,6 @@ package dctest
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
@ -64,7 +63,7 @@ func InitDynamic(t *testing.T, doc *ypath.Document, parentDir string) Cmd {
|
|||
name := filepath.Base(t.Name())
|
||||
fileName := filepath.Join(parentDir, fmt.Sprintf(".docker-compose.%s.yml", name))
|
||||
|
||||
err := ioutil.WriteFile(fileName, doc.Bytes(), os.ModePerm)
|
||||
err := os.WriteFile(fileName, doc.Bytes(), os.ModePerm)
|
||||
require.NoError(t, err)
|
||||
|
||||
cleanupOnce(t, func() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package logger
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"code.cloudfoundry.org/lager/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
func New(logger lager.Logger) *logrus.Logger {
|
||||
var log = &logrus.Logger{
|
||||
Out: ioutil.Discard,
|
||||
Out: io.Discard,
|
||||
Hooks: make(logrus.LevelHooks),
|
||||
Formatter: new(logrus.JSONFormatter),
|
||||
Level: logrus.DebugLevel,
|
||||
|
|
|
@ -3,7 +3,7 @@ package skycmd
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -77,7 +77,7 @@ func (flag *AuthTeamFlags) Format() (atc.TeamAuth, error) {
|
|||
|
||||
func (flag *AuthTeamFlags) formatFromFile() (atc.TeamAuth, error) {
|
||||
|
||||
content, err := ioutil.ReadFile(flag.Config.Path())
|
||||
content, err := os.ReadFile(flag.Config.Path())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
@ -212,7 +212,7 @@ var _ = Describe("Sky Server API", func() {
|
|||
response, err = skyServer.Client().Do(request)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
body, err = ioutil.ReadAll(response.Body)
|
||||
body, err = io.ReadAll(response.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package testflight_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
@ -32,7 +31,7 @@ var _ = Describe("Flying", func() {
|
|||
err = os.MkdirAll(input2, 0755)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(fixture, "run"),
|
||||
[]byte(`#!/bin/sh
|
||||
echo some output
|
||||
|
@ -44,7 +43,7 @@ exit 0
|
|||
)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(tmp, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: linux
|
||||
|
@ -83,7 +82,7 @@ run:
|
|||
|
||||
Describe("hijacking", func() {
|
||||
It("executes an interactive command in a running task's container", func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "run"),
|
||||
[]byte(`#!/bin/sh
|
||||
mkfifo /tmp/fifo
|
||||
|
@ -117,23 +116,23 @@ cat < /tmp/fifo
|
|||
BeforeEach(func() {
|
||||
gitIgnorePath := filepath.Join(input1, ".gitignore")
|
||||
|
||||
err := ioutil.WriteFile(gitIgnorePath, []byte(`*.exist`), 0644)
|
||||
err := os.WriteFile(gitIgnorePath, []byte(`*.exist`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
fileToBeIgnoredPath := filepath.Join(input1, "expect-not-to.exist")
|
||||
err = ioutil.WriteFile(fileToBeIgnoredPath, []byte(`ignored file content`), 0644)
|
||||
err = os.WriteFile(fileToBeIgnoredPath, []byte(`ignored file content`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
fileToBeIncludedPath := filepath.Join(input2, "expect-to.exist")
|
||||
err = ioutil.WriteFile(fileToBeIncludedPath, []byte(`included file content`), 0644)
|
||||
err = os.WriteFile(fileToBeIncludedPath, []byte(`included file content`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
file1 := filepath.Join(input1, "file-1")
|
||||
err = ioutil.WriteFile(file1, []byte(`file-1 contents`), 0644)
|
||||
err = os.WriteFile(file1, []byte(`file-1 contents`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
file2 := filepath.Join(input2, "file-2")
|
||||
err = ioutil.WriteFile(file2, []byte(`file-2 contents`), 0644)
|
||||
err = os.WriteFile(file2, []byte(`file-2 contents`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = os.Mkdir(filepath.Join(input1, ".git"), 0755)
|
||||
|
@ -146,10 +145,10 @@ cat < /tmp/fifo
|
|||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
gitHEADPath := filepath.Join(input1, ".git/HEAD")
|
||||
err = ioutil.WriteFile(gitHEADPath, []byte(`ref: refs/heads/master`), 0644)
|
||||
err = os.WriteFile(gitHEADPath, []byte(`ref: refs/heads/master`), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(fixture, "run"),
|
||||
[]byte(`#!/bin/sh
|
||||
cp -a input-1/. output-1/
|
||||
|
@ -168,12 +167,12 @@ cp -a input-2/. output-2/
|
|||
file1 := filepath.Join(tmp, "output-1", "file-1")
|
||||
file2 := filepath.Join(tmp, "output-2", "file-2")
|
||||
|
||||
_, err := ioutil.ReadFile(fileToBeIgnoredPath)
|
||||
_, err := os.ReadFile(fileToBeIgnoredPath)
|
||||
Expect(err).To(HaveOccurred())
|
||||
|
||||
Expect(ioutil.ReadFile(fileToBeIncludedPath)).To(Equal([]byte("included file content")))
|
||||
Expect(ioutil.ReadFile(file1)).To(Equal([]byte("file-1 contents")))
|
||||
Expect(ioutil.ReadFile(file2)).To(Equal([]byte("file-2 contents")))
|
||||
Expect(os.ReadFile(fileToBeIncludedPath)).To(Equal([]byte("included file content")))
|
||||
Expect(os.ReadFile(file1)).To(Equal([]byte("file-1 contents")))
|
||||
Expect(os.ReadFile(file2)).To(Equal([]byte("file-2 contents")))
|
||||
})
|
||||
|
||||
It("uploads git repo input and non git repo input, INCLUDING things in the .gitignore for git repo inputs", func() {
|
||||
|
@ -184,16 +183,16 @@ cp -a input-2/. output-2/
|
|||
file1 := filepath.Join(tmp, "output-1", "file-1")
|
||||
file2 := filepath.Join(tmp, "output-2", "file-2")
|
||||
|
||||
Expect(ioutil.ReadFile(fileToBeIgnoredPath)).To(Equal([]byte("ignored file content")))
|
||||
Expect(ioutil.ReadFile(fileToBeIncludedPath)).To(Equal([]byte("included file content")))
|
||||
Expect(ioutil.ReadFile(file1)).To(Equal([]byte("file-1 contents")))
|
||||
Expect(ioutil.ReadFile(file2)).To(Equal([]byte("file-2 contents")))
|
||||
Expect(os.ReadFile(fileToBeIgnoredPath)).To(Equal([]byte("ignored file content")))
|
||||
Expect(os.ReadFile(fileToBeIncludedPath)).To(Equal([]byte("included file content")))
|
||||
Expect(os.ReadFile(file1)).To(Equal([]byte("file-1 contents")))
|
||||
Expect(os.ReadFile(file2)).To(Equal([]byte("file-2 contents")))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("pulling down outputs", func() {
|
||||
It("works", func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "run"),
|
||||
[]byte(`#!/bin/sh
|
||||
echo hello > output-1/file-1
|
||||
|
@ -208,14 +207,14 @@ echo world > output-2/file-2
|
|||
file1 := filepath.Join(tmp, "output-1", "file-1")
|
||||
file2 := filepath.Join(tmp, "output-2", "file-2")
|
||||
|
||||
Expect(ioutil.ReadFile(file1)).To(Equal([]byte("hello\n")))
|
||||
Expect(ioutil.ReadFile(file2)).To(Equal([]byte("world\n")))
|
||||
Expect(os.ReadFile(file1)).To(Equal([]byte("hello\n")))
|
||||
Expect(os.ReadFile(file2)).To(Equal([]byte("world\n")))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("aborting", func() {
|
||||
It("terminates the running task", func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "run"),
|
||||
[]byte(`#!/bin/sh
|
||||
trap "echo task got sigterm; exit 1" TERM
|
||||
|
@ -243,7 +242,7 @@ wait
|
|||
|
||||
Context("when an optional input is not provided", func() {
|
||||
It("runs the task without error", func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "run"),
|
||||
[]byte(`#!/bin/sh
|
||||
ls`),
|
||||
|
@ -279,7 +278,7 @@ run:
|
|||
args: [some-resource/version]
|
||||
`
|
||||
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(tmp, "task.yml"),
|
||||
[]byte(taskFileContents),
|
||||
0644,
|
||||
|
@ -338,7 +337,7 @@ run:
|
|||
args: [mapped-resource/version]
|
||||
`
|
||||
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(tmp, "task.yml"),
|
||||
[]byte(taskFileContents),
|
||||
0644,
|
||||
|
@ -397,7 +396,7 @@ run:
|
|||
args: [some-resource/version]
|
||||
`
|
||||
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(tmp, "task.yml"),
|
||||
[]byte(taskFileContents),
|
||||
0644,
|
||||
|
@ -458,7 +457,7 @@ run:
|
|||
path: cat
|
||||
args: [some-resource/version]
|
||||
`
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(tmp, "task.yml"),
|
||||
[]byte(taskFileContents),
|
||||
0644,
|
||||
|
@ -482,7 +481,7 @@ run:
|
|||
|
||||
Context("when -j is not specified and local input in custom resource type is provided", func() {
|
||||
BeforeEach(func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "version"),
|
||||
[]byte(`#!/bin/sh
|
||||
echo hello from fixture
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package testflight_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
@ -21,7 +20,7 @@ var _ = Describe("Flying with an image_resource", func() {
|
|||
err := os.MkdirAll(fixture, 0755)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(fixture, "run"),
|
||||
[]byte(`#!/bin/sh
|
||||
ls /bin
|
||||
|
@ -32,7 +31,7 @@ ls /bin
|
|||
})
|
||||
|
||||
It("propagates the rootfs and metadata to the task", func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: linux
|
||||
|
@ -65,7 +64,7 @@ run:
|
|||
})
|
||||
|
||||
It("allows a version to be specified", func() {
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: linux
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package testflight_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
@ -36,7 +35,7 @@ var _ = Describe("A job with multiple inputs", func() {
|
|||
firstVersionA = newMockVersion("some-resource-a", "first-a")
|
||||
firstVersionB = newMockVersion("some-resource-b", "first-b")
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(tmp, "task.yml"),
|
||||
[]byte(`---
|
||||
platform: linux
|
||||
|
@ -67,7 +66,7 @@ run:
|
|||
err = os.Mkdir(localGitRepoBDir, 0755)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
err = ioutil.WriteFile(
|
||||
err = os.WriteFile(
|
||||
filepath.Join(localGitRepoBDir, "version"),
|
||||
[]byte("some-overridden-version"),
|
||||
0644,
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -150,7 +149,7 @@ var _ = BeforeEach(func() {
|
|||
SetDefaultConsistentlyPollingInterval(time.Second)
|
||||
|
||||
var err error
|
||||
tmp, err = ioutil.TempDir("", "testflight-tmp")
|
||||
tmp, err = os.MkdirTemp("", "testflight-tmp")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
flyTarget = testflightFlyTarget
|
||||
|
@ -170,7 +169,7 @@ func downloadFly(atcUrl string) (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
outFile, err := ioutil.TempFile("", "fly")
|
||||
outFile, err := os.CreateTemp("", "fly")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package testflight_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -44,7 +43,7 @@ run:
|
|||
|
||||
JustBeforeEach(func() {
|
||||
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "task.yml"),
|
||||
[]byte(taskFileContents),
|
||||
0755,
|
||||
|
@ -111,7 +110,7 @@ run:
|
|||
image_resource_type: mock
|
||||
echo_text: Hello World From Command Line
|
||||
`
|
||||
err := ioutil.WriteFile(
|
||||
err := os.WriteFile(
|
||||
filepath.Join(fixture, "vars.yml"),
|
||||
[]byte(varsContents),
|
||||
0755,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package topgun_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"regexp"
|
||||
"time"
|
||||
|
@ -117,7 +117,7 @@ var _ = Describe("Worker stalling", func() {
|
|||
It("resumes the build", func() {
|
||||
By("reattaching to the build")
|
||||
// consume all output so far
|
||||
_, err := ioutil.ReadAll(buildSession.Out)
|
||||
_, err := io.ReadAll(buildSession.Out)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// wait for new output
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"crypto/tls"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -135,7 +134,7 @@ var _ = BeforeEach(func() {
|
|||
Fly.Target = DeploymentName
|
||||
|
||||
var err error
|
||||
tmp, err = ioutil.TempDir("", "topgun-tmp")
|
||||
tmp, err = os.MkdirTemp("", "topgun-tmp")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
Fly.Home = filepath.Join(tmp, "fly-home")
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"crypto/x509/pkix"
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -48,7 +47,7 @@ var _ = Describe("Credhub", func() {
|
|||
credhubInstance = Instance("credhub")
|
||||
postgresInstance := JobInstance("postgres")
|
||||
|
||||
varsDir, err := ioutil.TempDir("", "vars")
|
||||
varsDir, err := os.MkdirTemp("", "vars")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
defer os.RemoveAll(varsDir)
|
||||
|
@ -65,7 +64,7 @@ var _ = Describe("Credhub", func() {
|
|||
"-v", "postgres_ip="+postgresInstance.IP,
|
||||
)
|
||||
|
||||
varsBytes, err := ioutil.ReadFile(varsStore)
|
||||
varsBytes, err := os.ReadFile(varsStore)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
var vars struct {
|
||||
|
@ -80,11 +79,11 @@ var _ = Describe("Credhub", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
clientCert := filepath.Join(varsDir, "client.cert")
|
||||
err = ioutil.WriteFile(clientCert, []byte(vars.CredHubClient.Certificate), 0644)
|
||||
err = os.WriteFile(clientCert, []byte(vars.CredHubClient.Certificate), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
clientKey := filepath.Join(varsDir, "client.key")
|
||||
err = ioutil.WriteFile(clientKey, []byte(vars.CredHubClient.PrivateKey), 0644)
|
||||
err = os.WriteFile(clientKey, []byte(vars.CredHubClient.PrivateKey), 0644)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
credhubClient, err = credhub.New(
|
||||
|
@ -243,7 +242,7 @@ func generateCredhubCerts(filepath string) (err error) {
|
|||
vars.CredHubClientAtc.PrivateKey = rootCaKey
|
||||
|
||||
varsYaml, _ := yaml.Marshal(&vars)
|
||||
ioutil.WriteFile(filepath, varsYaml, 0644)
|
||||
os.WriteFile(filepath, varsYaml, 0644)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package topgun_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
@ -37,7 +36,7 @@ var _ = XDescribe("Vault", func() {
|
|||
BeforeEach(func() {
|
||||
var err error
|
||||
|
||||
varsStore, err = ioutil.TempFile("", "vars-store.yml")
|
||||
varsStore, err = os.CreateTemp("", "vars-store.yml")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(varsStore.Close()).To(Succeed())
|
||||
|
||||
|
@ -163,7 +162,7 @@ var _ = XDescribe("Vault", func() {
|
|||
"-v", "web_instances=0",
|
||||
)
|
||||
|
||||
vaultCACertFile, err := ioutil.TempFile("", "vault-ca.cert")
|
||||
vaultCACertFile, err := os.CreateTemp("", "vault-ca.cert")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
vaultCACert := vaultCACertFile.Name()
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
@ -171,7 +170,7 @@ func RequestCredsInfo(webUrl, token string) ([]byte, error) {
|
|||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(resp.StatusCode).To(Equal(200))
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
return body, err
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package k8s_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
|
@ -30,7 +29,7 @@ var _ = Describe("Web HTTP or HTTPS(TLS) termination at web node", func() {
|
|||
CACertBytes, err := CACert.Export()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
caCertFile, err = ioutil.TempFile("", "ca")
|
||||
caCertFile, err = os.CreateTemp("", "ca")
|
||||
caCertFile.Write(CACertBytes)
|
||||
caCertFile.Close()
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -86,7 +85,7 @@ var _ = BeforeEach(func() {
|
|||
SetDefaultEventuallyTimeout(90 * time.Second)
|
||||
SetDefaultConsistentlyDuration(30 * time.Second)
|
||||
|
||||
tmp, err := ioutil.TempDir("", "topgun-tmp")
|
||||
tmp, err := os.MkdirTemp("", "topgun-tmp")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
fly = FlyCli{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue