mirror of https://github.com/etcd-io/dbtester.git
Merge 627ebc4ca7 into 4c8e30b24d
This commit is contained in:
commit
ef8a7df515
|
|
@ -16,7 +16,7 @@ package dbtester
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ type Config struct {
|
||||||
|
|
||||||
// ReadConfig reads control configuration file.
|
// ReadConfig reads control configuration file.
|
||||||
func ReadConfig(fpath string, analyze bool) (*Config, error) {
|
func ReadConfig(fpath string, analyze bool) (*Config, error) {
|
||||||
bts, err := ioutil.ReadFile(fpath)
|
bts, err := os.ReadFile(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -279,7 +279,7 @@ func ReadConfig(fpath string, analyze bool) (*Config, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath != "" && !analyze {
|
if cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath != "" && !analyze {
|
||||||
bts, err = ioutil.ReadFile(cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath)
|
bts, err = os.ReadFile(cfg.ConfigClientMachineInitial.GoogleCloudStorageKeyPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ package fileinspect
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -45,7 +44,7 @@ func writeData(fpath string, data []byte) (n int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createData() (dir string, n int64, err error) {
|
func createData() (dir string, n int64, err error) {
|
||||||
dir, err = ioutil.TempDir(os.TempDir(), "fileinspect-write-test")
|
dir, err = os.MkdirTemp(os.TempDir(), "fileinspect-write-test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/etcd-io/dbtester/pkg/remotestorage"
|
"github.com/etcd-io/dbtester/pkg/remotestorage"
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
kbs, err := ioutil.ReadFile("key.json")
|
kbs, err := os.ReadFile("key.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -37,7 +37,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// upload directories
|
// upload directories
|
||||||
// kbs, err := ioutil.ReadFile("key.json")
|
// kbs, err := os.ReadFile("key.json")
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// log.Fatal(err)
|
// log.Fatal(err)
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ package remotestorage
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
|
@ -91,9 +91,9 @@ func (g *GoogleCloudStorage) UploadFile(bucket, src, dst string, opts ...OpOptio
|
||||||
}
|
}
|
||||||
|
|
||||||
g.lg.Info("uploading", zap.String("source", src), zap.String("destination", dst))
|
g.lg.Info("uploading", zap.String("source", src), zap.String("destination", dst))
|
||||||
bts, err := ioutil.ReadFile(src)
|
bts, err := os.ReadFile(src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ioutil.ReadFile(%s) %v", src, err)
|
return fmt.Errorf("os.ReadFile(%s) %v", src, err)
|
||||||
}
|
}
|
||||||
if _, err := wc.Write(bts); err != nil {
|
if _, err := wc.Write(bts); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -144,9 +144,9 @@ func (g *GoogleCloudStorage) UploadDir(bucket, src, dst string, opts ...OpOption
|
||||||
if ret.ContentType != "" {
|
if ret.ContentType != "" {
|
||||||
wc.ContentType = ret.ContentType
|
wc.ContentType = ret.ContentType
|
||||||
}
|
}
|
||||||
bts, err := ioutil.ReadFile(fpath)
|
bts, err := os.ReadFile(fpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errc <- fmt.Errorf("ioutil.ReadFile(%s) %v", fpath, err)
|
errc <- fmt.Errorf("os.ReadFile(%s) %v", fpath, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, err := wc.Write(bts); err != nil {
|
if _, err := wc.Write(bts); err != nil {
|
||||||
|
|
|
||||||
3
util.go
3
util.go
|
|
@ -17,7 +17,6 @@ package dbtester
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
mrand "math/rand"
|
mrand "math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -90,7 +89,7 @@ func exist(fpath string) bool {
|
||||||
// and closes it. This prevents TCP/TLS connections from closing,
|
// and closes it. This prevents TCP/TLS connections from closing,
|
||||||
// therefore available for reuse.
|
// therefore available for reuse.
|
||||||
func gracefulClose(resp *http.Response) {
|
func gracefulClose(resp *http.Response) {
|
||||||
io.Copy(ioutil.Discard, resp.Body)
|
io.Copy(io.Discard, resp.Body)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue