-
Notifications
You must be signed in to change notification settings - Fork 87
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
Versioned object support #28
Versioned object support #28
Conversation
Codecov Report
@@ Coverage Diff @@
## master #28 +/- ##
========================================
- Coverage 76.49% 65% -11.5%
========================================
Files 14 26 +12
Lines 1021 2260 +1239
========================================
+ Hits 781 1469 +688
- Misses 167 568 +401
- Partials 73 223 +150
Continue to review full report at Codecov.
|
This PR is getting pretty epic. I've started adding a little dump-bucket for testing assumptions about how S3 itself works. It's a bit verbose at the moment and doesn't properly clean up after itself; I'll incrementally improve it over time. For now though, it has really helped work through some of the assumptions and corner cases in the S3 API. |
e5eeb1f
to
579fc08
Compare
OK I'm pullin' this monster out of WIP 😄 🎉 There ended up being a LOT of stuff that went in to making this work. I've tried to keep the versioning stuff optional for backend implementers. Essentially, I think we can offer a bit of an a-la-carte API to GoFakeS3 for users: implement what you need (as long as you implement the Core backend) and you should be able to get up and running with something mostly S3-ish for your needs without the rest of it. I realised that by the time we have absolutely everything in here somewhere (if that ever happens!), the API surface someone who wants to make a backend would have to implement would be insane! I haven't implemented versioning for the bolt or afero backends because it will take a lot of extra work to work out how, and I'd like to work on proper bucket listing pagination first (it's one of the next things on my list). This only supports versioning for the in-memory backend for now. I kept running into situations where I was writing I also had some trouble getting decent coverage reports considering the main test cases are more functional than unit tests (unit tests aren't especially useful here for the bulk of what we're doing). Go's testing tool isn't great at reporting coverage properly by default, so I've thrown together a simple script that calculates it correctly (I think) in From a testing point of view, I've focused primarily on rudimentary functional coverage of all the new stuff. I think there's not nearly enough test cases around the version listing, but once again I'd like to hold off going too test-crazy until I put a proper backend-certifying tester together. |
dd2a66d
to
68b2f7f
Compare
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.
That was a big one again ;-)
I also had some trouble getting decent coverage reports considering the main test cases are more functional than unit tests (unit tests aren't especially useful here for the bulk of what we're doing). Go's testing tool isn't great at reporting coverage properly by default, so I've thrown together a simple script that calculates it correctly (I think) in magefile.go, which is run using mage. I noticed the Makefile for the first time after I added it (oops!) but I'm not sure it's easily converted from Go to shell-in-make. How would you like me to proceed? I can probably convert it to a standalone go run program too if you'd prefer.
Let's remove the Makefile
and settle on one tool like mage
, we have to check whether the CircleCI stuff is somehow depending on it but I assume this would be a very minor change. Maybe worth adding that change in another PR.
Just for my understanding, is the reported codecov project coverage of 66.06% wrong or did you already changed codecov to use the magefile calculated one?
From a testing point of view, I've focused primarily on rudimentary functional coverage of all the new stuff. I think there's not nearly enough test cases around the version listing, but once again I'd like to hold off going too test-crazy until I put a proper backend-certifying tester together.
As the versioning is only applicable for some backends, the backend-certifying tester is probably more important, I agree!
Yeah, sorry 'bout that, it turned out to be a fairly large feature, much larger than I anticipated.
I haven't changed codecov, I didn't realise I had access to that otherwise I would've tried! 66% is kinda unsatisfyingly low, really, considering we were already at over 70. Let me see if I can add a couple more tests real quick. Unfortunately, once we get whole-project coverage, the number will drop sharply again though, as we have very patchy coverage of the other stuff in the backends and we won't recover until the backend certifying tester is up and firing (not sure when I'll get to it). EDIT: codecov says the coverage is 74.04% now, which is much more in line with what I was expecting! Must've had something to do with my Git mistake - the numbers you were seeing sounded like the numbers before I added a bunch more tests. Are you happy with |
Wait a second, I've broken something pretty badly here. There were changes I pushed up that seem to have vanished? I force-pushed after rebasing of master last night, but I have no idea what I've done wrong as a stack of fixes and extra tests are nowhere to be found. Sorry about this. Please give me a sec to find and fix what I've done wrong. |
35905ef
to
dd2a66d
Compare
Phew! Fixed it! Git fail... Ooooooops! |
…pointers Change to pointers is to better accomodate actually calling the backend yourself, which is frightfully unpleasant with value types if you don't need to pass anything. This isn't much better as it means you're passing 'double nils' sometimes, i.e. ListBucketVersions(..., nil, nil), so I expect to revisit this.
…nd for all child packages
… backend in most cases
e44e5c3
to
e21b02c
Compare
Hey wow! 64.91% is better than I expected! I thought we'd take a much bigger hit. I think there might still be some things not being included in the report but it's definitely showing all of the backends except I got rid of the magefile because it was a pain in the backside to get it running in Circle. I've replaced it with a tools script (using the old |
Now with the |
Thought I should open this as WIP in case there's any feedback, and to make the progress visible.
This will only support versioning in the memory backend for now: the iteration patterns are quite hard to fully satisfy. I think it will be tricky to support in the disk-based backends and I may opt to defer implementing this support there until a later PR if it gets too big/hard/nasty.
TODO: