X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a95f899d7ac84f29b3d019aa410d265bb40833e5..5b863886118890cc81b728a3a606ea823c836f2b:/services/keepstore/handlers_with_generic_volume_test.go diff --git a/services/keepstore/handlers_with_generic_volume_test.go b/services/keepstore/handlers_with_generic_volume_test.go index dda7edcec3..4ffb7f8f10 100644 --- a/services/keepstore/handlers_with_generic_volume_test.go +++ b/services/keepstore/handlers_with_generic_volume_test.go @@ -1,7 +1,12 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + package main import ( "bytes" + "context" ) // A TestableVolumeManagerFactory creates a volume manager with at least two TestableVolume instances. @@ -46,7 +51,7 @@ func testGetBlock(t TB, factory TestableVolumeManagerFactory, testHash string, t // Get should pass buf := make([]byte, len(testBlock)) - n, err := GetBlock(testHash, buf, nil) + n, err := GetBlock(context.Background(), testHash, buf, nil) if err != nil { t.Fatalf("Error while getting block %s", err) } @@ -66,7 +71,7 @@ func testPutRawBadDataGetBlock(t TB, factory TestableVolumeManagerFactory, // Get should fail buf := make([]byte, BlockSize) - size, err := GetBlock(testHash, buf, nil) + size, err := GetBlock(context.Background(), testHash, buf, nil) if err == nil { t.Fatalf("Got %+q, expected error while getting corrupt block %v", buf[:size], testHash) } @@ -77,18 +82,18 @@ func testPutBlock(t TB, factory TestableVolumeManagerFactory, testHash string, t setupHandlersWithGenericVolumeTest(t, factory) // PutBlock - if _, err := PutBlock(testBlock, testHash); err != nil { + if _, err := PutBlock(context.Background(), testBlock, testHash); err != nil { t.Fatalf("Error during PutBlock: %s", err) } // Check that PutBlock succeeds again even after CompareAndTouch - if _, err := PutBlock(testBlock, testHash); err != nil { + if _, err := PutBlock(context.Background(), testBlock, testHash); err != nil { t.Fatalf("Error during PutBlock: %s", err) } // Check that PutBlock stored the data as expected buf := make([]byte, BlockSize) - size, err := GetBlock(testHash, buf, nil) + size, err := GetBlock(context.Background(), testHash, buf, nil) if err != nil { t.Fatalf("Error during GetBlock for %q: %s", testHash, err) } else if bytes.Compare(buf[:size], testBlock) != 0 { @@ -106,14 +111,14 @@ func testPutBlockCorrupt(t TB, factory TestableVolumeManagerFactory, testableVolumes[1].PutRaw(testHash, badData) // Check that PutBlock with good data succeeds - if _, err := PutBlock(testBlock, testHash); err != nil { + if _, err := PutBlock(context.Background(), testBlock, testHash); err != nil { t.Fatalf("Error during PutBlock for %q: %s", testHash, err) } // Put succeeded and overwrote the badData in one volume, // and Get should return the testBlock now, ignoring the bad data. buf := make([]byte, BlockSize) - size, err := GetBlock(testHash, buf, nil) + size, err := GetBlock(context.Background(), testHash, buf, nil) if err != nil { t.Fatalf("Error during GetBlock for %q: %s", testHash, err) } else if bytes.Compare(buf[:size], testBlock) != 0 {