-
Notifications
You must be signed in to change notification settings - Fork 108
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
CON-9080 Remove checkLimit validation in favor of forbidden response when creating a volume #481
Changes from all commits
bb280e9
90f1972
cb4f9ec
7612e01
0dbbc1e
910a432
1aa54c8
68afc7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,9 +155,11 @@ func (f *fakeAccountDriver) Get(context.Context) (*godo.Account, *godo.Response, | |
} | ||
|
||
type fakeStorageDriver struct { | ||
volumes map[string]*godo.Volume | ||
snapshots map[string]*godo.Snapshot | ||
listVolumesErr error | ||
volumes map[string]*godo.Volume | ||
snapshots map[string]*godo.Snapshot | ||
listVolumesErr error | ||
createVolumeErr error | ||
createVolumeErrResponse *godo.Response | ||
} | ||
|
||
func (f *fakeStorageDriver) ListVolumes(ctx context.Context, param *godo.ListVolumeParams) ([]godo.Volume, *godo.Response, error) { | ||
|
@@ -213,6 +215,10 @@ func (f *fakeStorageDriver) GetVolume(ctx context.Context, id string) (*godo.Vol | |
} | ||
|
||
func (f *fakeStorageDriver) CreateVolume(ctx context.Context, req *godo.VolumeCreateRequest) (*godo.Volume, *godo.Response, error) { | ||
if f.createVolumeErr != nil || f.createVolumeErrResponse != nil { | ||
return nil, f.createVolumeErrResponse, f.createVolumeErr | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we return as soon as one of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! It gives more flexibility in the tests. Added. |
||
} | ||
|
||
id := randString(10) | ||
vol := &godo.Volume{ | ||
ID: id, | ||
|
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.
@timoreimann ,
Here we have a payload ressembling this :
I'm not looking at the
id
field of theCreateVolume
response for the exact match offorbidden
since it is not exported by godo. Instead, I'm relying on the http code of the response which is kind of the same check IMO. What do you think ?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.
Ah, wasn't aware it's not exported. I think your approach makes sense then. 👍