Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: client/archiver/archiver_test.go

Issue 1846263002: Isolate: Use generators instead of seekers (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Tweaks from comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: client/archiver/archiver_test.go
diff --git a/client/archiver/archiver_test.go b/client/archiver/archiver_test.go
index 481d0e63912e129f797b345ad6dcc67cc15941b4..777c10187adab7530ea5d628212b8e40d9b611b9 100644
--- a/client/archiver/archiver_test.go
+++ b/client/archiver/archiver_test.go
@@ -5,7 +5,6 @@
package archiver
import (
- "bytes"
"fmt"
"io/ioutil"
"log"
@@ -86,7 +85,7 @@ func TestArchiverFileHit(t *testing.T) {
defer ts.Close()
a := New(isolatedclient.New(nil, ts.URL, "default-gzip"), nil)
server.Inject([]byte("foo"))
- future := a.Push("foo", bytes.NewReader([]byte("foo")), 0)
+ future := a.Push("foo", isolatedclient.NewBytesSource([]byte("foo")), 0)
future.WaitForHashed()
ut.AssertEqual(t, isolated.HexDigest("0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33"), future.Digest())
ut.AssertEqual(t, nil, a.Close())
@@ -127,7 +126,7 @@ func TestArchiverCancel(t *testing.T) {
if common.IsWindows() {
osErr = "The system cannot find the file specified."
}
- expected := fmt.Errorf("hash(foo) failed: open %s: %s\n", nonexistent, osErr)
+ expected := fmt.Errorf("source(foo) failed: open %s: %s\n", nonexistent, osErr)
ut.AssertEqual(t, expected, <-a.Channel())
ut.AssertEqual(t, expected, a.Close())
ut.AssertEqual(t, nil, server.Error())
@@ -139,17 +138,3 @@ func TestArchiverPushClosed(t *testing.T) {
ut.AssertEqual(t, nil, a.Close())
ut.AssertEqual(t, nil, a.PushFile("ignored", "ignored", 0))
}
-
-func TestArchiverPushSeeked(t *testing.T) {
- t.Parallel()
- server := isolatedfake.New()
- ts := httptest.NewServer(server)
- defer ts.Close()
- a := New(isolatedclient.New(nil, ts.URL, "default-gzip"), nil)
- misplaced := bytes.NewReader([]byte("foo"))
- _, _ = misplaced.Seek(1, os.SEEK_SET)
- future := a.Push("works", misplaced, 0)
- future.WaitForHashed()
- ut.AssertEqual(t, isolated.HexDigest("0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33"), future.Digest())
- ut.AssertEqual(t, nil, a.Close())
-}

Powered by Google App Engine
This is Rietveld 408576698