From b03aff318e7fbbb1a1815ecaefaa73065b322ca0 Mon Sep 17 00:00:00 2001 From: "iteyelmp@gmail.com" Date: Mon, 18 Dec 2023 15:53:14 +0800 Subject: [PATCH] fix cmd/es-utils/utils test error --- cmd/es-utils/utils/utils_test.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/es-utils/utils/utils_test.go b/cmd/es-utils/utils/utils_test.go index 99a054c0..ca959dff 100644 --- a/cmd/es-utils/utils/utils_test.go +++ b/cmd/es-utils/utils/utils_test.go @@ -1,14 +1,11 @@ // Copyright 2022-2023, EthStorage. // For license information, see https://github.com/ethstorage/es-node/blob/main/LICENSE -//go:build !ci - package utils import ( "bytes" - "io" - "net/http" + "os" "testing" ) @@ -40,12 +37,14 @@ func generateSequentialBytes(t *testing.T, n int) []byte { } func readTxt(t *testing.T, n int) []byte { - resp, err := http.Get("https://www.gutenberg.org/cache/epub/11/pg11.txt") + f, err := os.Open("../blob_8k.dat") if err != nil { - t.Fatal("read txt error") + t.Fatal("read file error") } - defer resp.Body.Close() - data, err := io.ReadAll(resp.Body) + defer f.Close() + + data := make([]byte, 1024) + _, err = f.Read(data) if err != nil { t.Fatal("read txt error") }