You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
I have an usecase where I want to cleanup objects created a certain time ago.
For that I create a new object (putObject()) with an ObjectMetaDatas lastModified far in the past.
Unfortunately this date always gets overriden in both, FileProvider as well as InMemoryProvider.
My proposal: Set the current DateTime for an empty lastModified only, keep the set value otherwise.
The text was updated successfully, but these errors were encountered:
I have a similar use case for checking the last modified time of an object. I solved it by modified the object meta in the metastore:
val api = S3Mock(port = port, dir = dir)
def overwriteLastModified(bucket: String, key: String, date: Date): Unit = {
val metastore = api.p.metadataStore
val meta = metastore.get(bucket, objectKey) // ObjectMetadata
meta.setLastModified(date)
metastore.put(bucket, objectKey, meta)
}
At least this works for me. In my case, the object is created as part of the preparation for the test. So I usually do:
mockS3.putObject(bucket, key, data)
overwriteLastModified(bucket, key)
// run the test
But I agree, ideally, the S3Mock should behave as what you raised. Hopefully, what I did can help your case.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have an usecase where I want to cleanup objects created a certain time ago.
For that I create a new object (putObject()) with an ObjectMetaDatas lastModified far in the past.
Unfortunately this date always gets overriden in both, FileProvider as well as InMemoryProvider.
My proposal: Set the current DateTime for an empty lastModified only, keep the set value otherwise.
The text was updated successfully, but these errors were encountered: