New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get file size from S3 after upload + fix upload #4952
Get file size from S3 after upload + fix upload #4952
Conversation
/** | ||
* Allows to resolve an ''S'' to an ''A'' | ||
*/ | ||
trait Lens[S, A] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code is dead
/** | ||
* Convert the array of bytes to a string of the hexadecimal values | ||
*/ | ||
def valueOf(value: Array[Byte]): String = value.map("%02x".format(_)).mkString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common shared utility method
final case object NotComputedDigest extends Digest { | ||
override val computed: Boolean = false | ||
} | ||
final case object NoDigest extends Digest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly different from the other one (NotComputedDigest) where we were expecting it to be computed in the future
/** | ||
* Rejection returned when a file can not be saved because content-length is not provided | ||
*/ | ||
final case object ContentLengthIsMissing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When doing a put with a stream and asking for a checksum, it seems that the content length is needed
case class HeadObject(fileSize: Long, contentType: Option[ContentType], digest: Digest) | ||
|
||
object HeadObject { | ||
def apply(response: HeadObjectResponse): HeadObject = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smart constructor to add more value to the class
http { | ||
client { | ||
parsing { | ||
max-content-length="100g" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To test with larger files
extraHeaders: Seq[HttpHeader] = jsonHeaders | ||
)(assertResponse: (A, HttpResponse) => Assertion)(implicit um: FromEntityUnmarshaller[A]): IO[Assertion] = { | ||
def buildClue(a: A, response: HttpResponse) = | ||
def uploadFile(project: String, storage: String, file: FileInput, rev: Option[Int])( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored the tests to do a general use of FileInput
@@ -309,4 +311,27 @@ class S3StorageSpec extends StorageSpec { | |||
} yield assertion | |||
} | |||
} | |||
|
|||
"Uploading a large file" should { | |||
"succeed" ignore { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignored for now as it takes ~2min to complete
We may want to introduce a slow tag for those and still run them from time to time in a scheduled fashion
(there is at least another one for archives iirc)
Fixes #4944