gomods / athens

A Go module datastore and proxy
https://docs.gomods.io
MIT License
4.41k stars 496 forks source link

Mock out VCS/go get in order to improve testing speed #1368

Open twexler opened 5 years ago

twexler commented 5 years ago

Is your feature request related to a problem? Please describe. During office hours, we discussed testing athens, and it seemed like one issue is that we have to actually call out to somewhere public to run tests. This isn't ideal for several reasons.

Describe the solution you'd like Ideally, this would just be a module.Fetcher implemented against a set of local filesystem objects

Describe alternatives you've considered None considered

Additional context Add any other context or screenshots about the feature request here.

marwan-at-work commented 5 years ago

@twexler can you specify which tests exactly should be using a mock? I believe we do have a mock implementation of module.Fetcher but we also test the live-internet-y code for good reasons to make sure things function properly. I can help you look around if you're not sure which tests would you like to mock out. Thanks!

yolocs commented 5 years ago

Seems similar to https://github.com/gomods/athens/issues/1359?

twexler commented 5 years ago

@marwan-at-work I need to rewatch yesterday's office hours to regain context, but as mentioned this came up during that meeting

twexler commented 5 years ago

@yolo3301 it seems fairly similar to that issue, maybe sort of a duplicate?

arschles commented 5 years ago

There could be two levels to this. a Mock VCS could help us isolate the caller / response parsing code from the code that sets up the command and environment. the mock binary in #1359 could validate the code to set up the command/env

arschles commented 4 years ago

Seems similar to #1359?

@yolocs yes, I think this is exactly the same. #1449 should fix both of these issues