11package client
22
33import (
4+ "context"
45 "testing"
56
67 "gotest.tools/v3/assert"
@@ -16,7 +17,7 @@ func TestGetRemoteFileWithoutDecryption(t *testing.T) {
1617 },
1718 }
1819 store := & StoreStub {
19- DownloadFileFunc : func (remotePath string , localPath string ) (string , error ) {
20+ DownloadFileFunc : func (ctx context. Context , remotePath string , localPath string ) (string , error ) {
2021 assert .Check (t , is .Equal ("s3://foo/bar.txt" , remotePath ))
2122 assert .Check (t , is .Equal ("bar.txt" , localPath ))
2223 return "muahahaha" , nil
@@ -26,7 +27,7 @@ func TestGetRemoteFileWithoutDecryption(t *testing.T) {
2627 Hash : hash ,
2728 Store : store ,
2829 }
29- assert .NilError (t , c .GetRemoteFile ("s3://foo/bar.txt" , "bar.txt" ))
30+ assert .NilError (t , c .GetRemoteFile (t . Context (), "s3://foo/bar.txt" , "bar.txt" ))
3031}
3132
3233func TestGetRemoteFileWithDecryption (t * testing.T ) {
@@ -38,7 +39,7 @@ func TestGetRemoteFileWithDecryption(t *testing.T) {
3839 },
3940 }
4041 store := & StoreStub {
41- DownloadFileFunc : func (remotePath string , localPath string ) (string , error ) {
42+ DownloadFileFunc : func (ctx context. Context , remotePath string , localPath string ) (string , error ) {
4243 assert .Check (t , is .Equal ("s3://foo/bar.txt" , remotePath ))
4344 assert .Check (t , is .Equal ("bar.txt.tmp" , localPath ))
4445 return "muahahaha" , nil
@@ -56,7 +57,7 @@ func TestGetRemoteFileWithDecryption(t *testing.T) {
5657 Store : store ,
5758 Cipher : cipher ,
5859 }
59- assert .NilError (t , c .GetRemoteFile ("s3://foo/bar.txt" , "bar.txt" ))
60+ assert .NilError (t , c .GetRemoteFile (t . Context (), "s3://foo/bar.txt" , "bar.txt" ))
6061}
6162
6263func TestPutLocalFileWithoutEncryption (t * testing.T ) {
@@ -67,7 +68,7 @@ func TestPutLocalFileWithoutEncryption(t *testing.T) {
6768 },
6869 }
6970 store := & StoreStub {
70- UploadFileFunc : func (remotePath string , localPath string , checksum string ) error {
71+ UploadFileFunc : func (ctx context. Context , remotePath string , localPath string , checksum string ) error {
7172 assert .Check (t , is .Equal ("s3://foo/bar.txt" , remotePath ))
7273 assert .Check (t , is .Equal ("bar.txt" , localPath ))
7374 assert .Check (t , is .Equal ("woahahaha" , checksum ))
@@ -78,7 +79,7 @@ func TestPutLocalFileWithoutEncryption(t *testing.T) {
7879 Hash : hash ,
7980 Store : store ,
8081 }
81- assert .NilError (t , c .PutLocalFile ("s3://foo/bar.txt" , "bar.txt" ))
82+ assert .NilError (t , c .PutLocalFile (t . Context (), "s3://foo/bar.txt" , "bar.txt" ))
8283}
8384
8485func TestPutLocalFileWithEncryption (t * testing.T ) {
@@ -89,7 +90,7 @@ func TestPutLocalFileWithEncryption(t *testing.T) {
8990 },
9091 }
9192 store := & StoreStub {
92- UploadFileFunc : func (remotePath string , localPath string , checksum string ) error {
93+ UploadFileFunc : func (ctx context. Context , remotePath string , localPath string , checksum string ) error {
9394 assert .Check (t , is .Equal ("s3://foo/bar.txt" , remotePath ))
9495 assert .Check (t , is .Equal ("bar.txt.tmp" , localPath ))
9596 assert .Check (t , is .Equal ("woahahaha" , checksum ))
@@ -108,5 +109,5 @@ func TestPutLocalFileWithEncryption(t *testing.T) {
108109 Store : store ,
109110 Cipher : cipher ,
110111 }
111- assert .NilError (t , c .PutLocalFile ("s3://foo/bar.txt" , "bar.txt" ))
112+ assert .NilError (t , c .PutLocalFile (t . Context (), "s3://foo/bar.txt" , "bar.txt" ))
112113}
0 commit comments