@@ -81,6 +81,33 @@ func (s *UploadTestSuite) TestUpload() {
8181 // If the binary is smaller than 100 bytes, compare the whole thing
8282 s .Equal (expected , actual , "binary data do not match" )
8383 }
84+
85+ // SadPath: Bad filepath
86+ backOffSleep = 1 * time .Millisecond
87+ badFilepathUploadInput := & UploadInput {
88+ PresignedURL : fmt .Sprintf ("http://localhost:%s/artifacts/%s/binary.wasm" , testServerPort , artifacts .GetWorkflowID ()),
89+ PresignedFields : []Field {
90+ {Key : "key1" , Value : "value1" },
91+ },
92+ Filepath : "testdata/binary" ,
93+ Timeout : 10 * time .Second ,
94+ }
95+ err = artifacts .DurableUpload (badFilepathUploadInput )
96+ s .ErrorContains (err , "upload failed after 3 attempts: failed to read file: open" ,
97+ "failed to upload artifact" )
98+
99+ // SadPath: Bad presigned URL
100+ badPresignedURLUploadInput := & UploadInput {
101+ PresignedURL : fmt .Sprintf ("http://localhost:%s/artifacts2/%s/binary.wasm" , testServerPort , artifacts .GetWorkflowID ()),
102+ PresignedFields : []Field {
103+ {Key : "key1" , Value : "value1" },
104+ },
105+ Filepath : artifacts .GetBinaryPath (),
106+ Timeout : 10 * time .Second ,
107+ }
108+ err = artifacts .DurableUpload (badPresignedURLUploadInput )
109+ s .ErrorContains (err , "upload failed after 3 attempts: expected status 204 or 201, got 404" ,
110+ "failed to upload artifact" )
84111}
85112
86113func TestUploadTestSuite (t * testing.T ) {
0 commit comments