zs3 icon indicating copy to clipboard operation
zs3 copied to clipboard

What would a test framework for zs3 look like?

Open kat-co opened this issue 5 years ago • 2 comments

Hey @xach, we chatted briefly a few times last year about submitting some code to zs3 to support things like multipart uploads, and DigitalOcean support.

It would be nice to have a set of tests to rely on so I can ensure things aren't breaking. Have you put any thought into this space?

kat-co avatar Jan 23 '20 23:01 kat-co

I took a look at the official AWS Go client to see how they are doing testing, and it looks like they've taken the mocking approach.

  • First they piggy-back off of a default config and then populate[1] it with mocked values.
  • The library appears to use a list of Handlers to handle requests at very stages. They clear, the default list and replace it with mocked functions[2].

Since this is the official Go client for all of AWS, they have a lot of resources working on this. I'm trying to consider whether this style of testing would lend itself to zs3, assuming you are open to it.

[1] - https://github.com/aws/aws-sdk-go-v2/blob/9503cfa08dd8766632c983f916d053fef919277d/internal/awstesting/unit/unit.go#L10-L18 [2] - https://github.com/aws/aws-sdk-go-v2/blob/master/service/s3/bucket_location_test.go#L28-L32

kat-co avatar Jan 24 '20 16:01 kat-co

My first instinct is to use simulated network activity in the form of files. The response object is either populated directly from a file, or the drakma result is simulated from a file, and the response is parsed out from there.

On Fri, Jan 24, 2020 at 11:36 AM Katherine Cox-Buday < [email protected]> wrote:

I took a look at the official AWS Go client to see how they are doing testing, and it looks like they've taken the mocking approach.

Since this is the official Go client for all of AWS, they have a lot of resources working on this. I'm trying to consider whether this style of testing would lend itself to zs3, assuming you are open to it.

[1] - https://github.com/aws/aws-sdk-go-v2/blob/9503cfa08dd8766632c983f916d053fef919277d/internal/awstesting/unit/unit.go#L10-L18 [2] - https://github.com/aws/aws-sdk-go-v2/blob/master/service/s3/bucket_location_test.go#L28-L32

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xach/zs3/issues/38?email_source=notifications&email_token=AAAEB7YFRJGVZFPDHWTO7V3Q7MKILA5CNFSM4KK6S2CKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ3LKOQ#issuecomment-578204986, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEB7Y6DUUIZSPRGFIAVA3Q7MKILANCNFSM4KK6S2CA .

xach avatar Jan 27 '20 21:01 xach