@@ -723,19 +723,6 @@ func TestUploadFileError(t *testing.T) {
723
723
}
724
724
}
725
725
726
- func TestWriteTGZFromURL (t * testing.T ) {
727
- ctx := access .FakeContextWithOutgoingIAPAuth (context .Background (), fakeIAP ())
728
- client := setupGomoteTest (t , context .Background ())
729
- gomoteID := mustCreateInstance (t , client , fakeIAP ())
730
- if _ , err := client .WriteTGZFromURL (ctx , & protos.WriteTGZFromURLRequest {
731
- GomoteId : gomoteID ,
732
- Directory : "foo" ,
733
- Url : `https://go.dev/dl/go1.17.6.linux-amd64.tar.gz` ,
734
- }); err != nil {
735
- t .Fatalf ("client.WriteTGZFromURL(ctx, req) = response, %s; want no error" , err )
736
- }
737
- }
738
-
739
726
// TODO(go.dev/issue/48737) add test for files on GCS
740
727
func TestWriteFileFromURL (t * testing.T ) {
741
728
ctx := access .FakeContextWithOutgoingIAPAuth (context .Background (), fakeIAP ())
@@ -817,6 +804,32 @@ func TestWriteFileFromURLError(t *testing.T) {
817
804
}
818
805
}
819
806
807
+ func TestWriteTGZFromURL (t * testing.T ) {
808
+ ctx := access .FakeContextWithOutgoingIAPAuth (context .Background (), fakeIAP ())
809
+ client := setupGomoteTest (t , context .Background ())
810
+ gomoteID := mustCreateInstance (t , client , fakeIAP ())
811
+ if _ , err := client .WriteTGZFromURL (ctx , & protos.WriteTGZFromURLRequest {
812
+ GomoteId : gomoteID ,
813
+ Directory : "foo" ,
814
+ Url : `https://go.dev/dl/go1.17.6.linux-amd64.tar.gz` ,
815
+ }); err != nil {
816
+ t .Fatalf ("client.WriteTGZFromURL(ctx, req) = response, %s; want no error" , err )
817
+ }
818
+ }
819
+
820
+ func TestWriteTGZFromURLGomoteStaging (t * testing.T ) {
821
+ ctx := access .FakeContextWithOutgoingIAPAuth (context .Background (), fakeIAP ())
822
+ client := setupGomoteTest (t , context .Background ())
823
+ gomoteID := mustCreateInstance (t , client , fakeIAP ())
824
+ if _ , err := client .WriteTGZFromURL (ctx , & protos.WriteTGZFromURLRequest {
825
+ GomoteId : gomoteID ,
826
+ Directory : "foo" ,
827
+ Url : fmt .Sprintf ("https://storage.googleapis.com/%s/go1.17.6.linux-amd64.tar.gz?field=x" , testBucketName ),
828
+ }); err != nil {
829
+ t .Fatalf ("client.WriteTGZFromURL(ctx, req) = response, %s; want no error" , err )
830
+ }
831
+ }
832
+
820
833
func TestWriteTGZFromURLError (t * testing.T ) {
821
834
// This test will create a gomote instance and attempt to call TestWriteTGZFromURL.
822
835
// If overrideID is set to true, the test will use a different gomoteID than the
@@ -862,6 +875,12 @@ func TestWriteTGZFromURLError(t *testing.T) {
862
875
url : "go.dev/dl/1_14.tar.gz" ,
863
876
wantCode : codes .PermissionDenied ,
864
877
},
878
+ {
879
+ desc : "invalid gomote staging bucket URL" ,
880
+ ctx : access .FakeContextWithOutgoingIAPAuth (context .Background (), fakeIAP ()),
881
+ url : fmt .Sprintf ("https://storage.googleapis.com/%s/go1.17.6.linux-amd64.tar.gz" , testBucketName ),
882
+ wantCode : codes .InvalidArgument ,
883
+ },
865
884
}
866
885
for _ , tc := range testCases {
867
886
t .Run (tc .desc , func (t * testing.T ) {
0 commit comments