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

Unified Diff: cipd/client/cipd/local/reader_test.go

Issue 2877643002: [cipd] stop doing weird ownership transfer (Closed)
Patch Set: fix nit Created 3 years, 7 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
« no previous file with comments | « cipd/client/cipd/local/reader.go ('k') | cipd/client/cli/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cipd/client/cipd/local/reader_test.go
diff --git a/cipd/client/cipd/local/reader_test.go b/cipd/client/cipd/local/reader_test.go
index 7ad2b8f43f74b5571758274f365b3615b4028b86..d73688c81e2528807bc19d1fc2ea22d82efb16d0 100644
--- a/cipd/client/cipd/local/reader_test.go
+++ b/cipd/client/cipd/local/reader_test.go
@@ -64,9 +64,6 @@ func TestPackageReading(t *testing.T) {
// Open it.
inst, err := OpenInstance(ctx, bytes.NewReader(out.Bytes()), "", VerifyHash)
- if inst != nil {
- defer inst.Close()
- }
So(inst, ShouldNotBeNil)
So(err, ShouldBeNil)
So(inst.Pin(), ShouldResemble, Pin{"testing", "23f2c4900785ac8faa2f38e473925b840e574ccc"})
@@ -107,7 +104,6 @@ func TestPackageReading(t *testing.T) {
So(err, ShouldBeNil)
So(inst, ShouldNotBeNil)
So(inst.Pin(), ShouldResemble, Pin{"testing", "23f2c4900785ac8faa2f38e473925b840e574ccc"})
- inst.Close()
// Attempt to open it, providing incorrect instance ID.
inst, err = OpenInstance(ctx, source, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", VerifyHash)
@@ -119,7 +115,6 @@ func TestPackageReading(t *testing.T) {
So(err, ShouldBeNil)
So(inst, ShouldNotBeNil)
So(inst.Pin(), ShouldResemble, Pin{"testing", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"})
- inst.Close()
})
Convey("OpenInstanceFile works", t, func() {
@@ -139,12 +134,10 @@ func TestPackageReading(t *testing.T) {
tempFile.Close()
// Read the package.
- inst, err := OpenInstanceFile(ctx, tempFilePath, "", VerifyHash)
- if inst != nil {
- defer inst.Close()
- }
- So(inst, ShouldNotBeNil)
+ inst, closer, err := OpenInstanceFile(ctx, tempFilePath, "", VerifyHash)
So(err, ShouldBeNil)
+ defer closer()
+ So(inst, ShouldNotBeNil)
})
Convey("ExtractInstance works", t, func() {
@@ -176,9 +169,6 @@ func TestPackageReading(t *testing.T) {
// Extract files.
inst, err := OpenInstance(ctx, bytes.NewReader(out.Bytes()), "", VerifyHash)
- if inst != nil {
- defer inst.Close()
- }
So(err, ShouldBeNil)
dest := &testDestination{}
err = ExtractInstance(ctx, inst, dest, func(f File) bool {
« no previous file with comments | « cipd/client/cipd/local/reader.go ('k') | cipd/client/cli/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698