replace deprecated ioutil (#2531)

* replace deprecated ioutil
* replace ioutil also in kubectl plugin
This commit is contained in:
Felix Kunde
2024-02-05 11:58:36 +01:00
committed by GitHub
parent 8a1b2f4f69
commit bf5db676b1
8 changed files with 22 additions and 23 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ package cluster
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"
"time"
@@ -86,7 +86,7 @@ func TestGetSwitchoverCandidate(t *testing.T) {
for _, tt := range tests {
// mocking cluster members
r := ioutil.NopCloser(bytes.NewReader([]byte(tt.clusterJson)))
r := io.NopCloser(bytes.NewReader([]byte(tt.clusterJson)))
response := http.Response{
StatusCode: 200,
+5 -5
View File
@@ -3,7 +3,7 @@ package cluster
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"net/http"
"testing"
"time"
@@ -201,7 +201,7 @@ func TestCheckAndSetGlobalPostgreSQLConfiguration(t *testing.T) {
// mocking a config after setConfig is called
configJson := `{"postgresql": {"parameters": {"log_min_duration_statement": 200, "max_connections": 50}}}, "ttl": 20}`
r := ioutil.NopCloser(bytes.NewReader([]byte(configJson)))
r := io.NopCloser(bytes.NewReader([]byte(configJson)))
response := http.Response{
StatusCode: 200,
@@ -531,7 +531,7 @@ func TestSyncStandbyClusterConfiguration(t *testing.T) {
// mocking a config after getConfig is called
mockClient := mocks.NewMockHTTPClient(ctrl)
configJson := `{"ttl": 20}`
r := ioutil.NopCloser(bytes.NewReader([]byte(configJson)))
r := io.NopCloser(bytes.NewReader([]byte(configJson)))
response := http.Response{
StatusCode: 200,
Body: r,
@@ -540,7 +540,7 @@ func TestSyncStandbyClusterConfiguration(t *testing.T) {
// mocking a config after setConfig is called
standbyJson := `{"standby_cluster":{"create_replica_methods":["bootstrap_standby_with_wale","basebackup_fast_xlog"],"restore_command":"envdir \"/run/etc/wal-e.d/env-standby\" /scripts/restore_command.sh \"%f\" \"%p\""}}`
r = ioutil.NopCloser(bytes.NewReader([]byte(standbyJson)))
r = io.NopCloser(bytes.NewReader([]byte(standbyJson)))
response = http.Response{
StatusCode: 200,
Body: r,
@@ -582,7 +582,7 @@ func TestSyncStandbyClusterConfiguration(t *testing.T) {
assert.NoError(t, err)
configJson = `{"standby_cluster":{"create_replica_methods":["bootstrap_standby_with_wale","basebackup_fast_xlog"],"restore_command":"envdir \"/run/etc/wal-e.d/env-standby\" /scripts/restore_command.sh \"%f\" \"%p\""}, "ttl": 20}`
r = ioutil.NopCloser(bytes.NewReader([]byte(configJson)))
r = io.NopCloser(bytes.NewReader([]byte(configJson)))
response = http.Response{
StatusCode: 200,
Body: r,