Comments (7)
I would like to make this my top priority as I wish to use this library to implement a new suite of integration tests here @mailgun
from mailgun-go.
I'm certainly open to the idea. The main problem I see is the need for API keys for testing - do you have any idea how to solve this?
from mailgun-go.
@mbanzon We have an account specifically for testing -- we can set up encrypted secrets with Travis to expose the API keys that are needed for tests :)
from mailgun-go.
Good idea @pirogoeth. It's probably the easiest option when using wercker or travis.
A second option is to run tests separately. I will look for some solutions this week.
But, to be honest, in my opinion it's not practical to not run tests against the real mailgun api. I know that it feels safer to test against the real endpoint, but in fact, you cannot change the behavior of this endpoint within this package. Because in this package you can only control the request itself and the handling of the possible responses.
What happens if mailgun changes the api willingly?
With the tests against the api, the upcoming tests will fail. But only if there are any at this time. Most likely you, as the library devs, should/will know of the problem before.
What happens if mailgun is offline or mailgun response (accidentally) changed?
It's not on the library to check these possibilities, because there no chance to "fix" it. The only thing that can be tested is the handling for these cases.
Sorry for the edit and long post. Just wanted to publish my thoughts.
from mailgun-go.
@sbani you are correct.
Using Travis eg. would give the advantage to show PR's breaking changes - at least breaking with the Mailgun API - as you mention it is not really the concern of the package - it is trivial to test (locally) before merging and somewhat difficult to setup - failing doesn't even mean anything was changed to brake compatibility with the API, it might be the API causing the brake. Furthermore the changes I'm most concerned about at the moment are changes in the library that may cause braking builds by users - a well crafted PR should change tests accordingly so these changes shouldn't ever be an issue with CI - they'll be missed completely.
Personally I don't know of any Mailgun changes before they hit me in the face.
I've tried to set something up for now but as I am not the administrator of the repository Travis will not let me setup the webhook - this complicates matters further. I realized that if I set up the Travis integration I need to have an extra Mailgun account for these testing purposes - and the owners/contributers of the repo should rely on me being around (for ever-ish). This isn't a problem - for now - but it seems somewhat limiting.
There more I think about it, there more I lean towards not having Travis eg. setup for this library for these reasons (test-account upkeep etc.). One small addition could be to have a test.bash
with environment variables etc. specified (but not set) and then have local_test.bash
(or something similar) added to .gitignore
- contributers could then simply copy the included test.bash
and add their keys etc. and have easy access to testing.
Let me know what you guys think - I'd love to se an elegant solution.
from mailgun-go.
@thrawn01 what is your thoughts on this regarding API keys etc?
from mailgun-go.
We are using a mailgun testing account which is used for travis-ci, the API keys are in travis and are restricted to members of the mailgun repo. In addition the tests will not run against Pull Requests as this could expose the API Key to malicious code. IE fmt.Println(os.Getenv("MG_API_KEY"))
then users could look at the travis logs.
I'm going to close this as this is the easiest path to testing. Eventually I would like to add more unit/mocked tests but that will have to be another day. =(
from mailgun-go.
Related Issues (20)
- Remove dependancy on Chi
- Make fields public in struct `mailgun.Message`. HOT 3
- SetDeliveryTime Ignored HOT 1
- Change response for `VerifyDomain` method from (string, error) to (DomainResponse, error) HOT 2
- How to convert json stored messages to url.Values HOT 1
- Make properties on Message struct publicly accessible HOT 2
- missing `result` in email validation response HOT 4
- VerifyAndReturnDomain is missing from the Mailgun interface
- Validate domain in mg.Send()
- Allow to use : in domain for testing HOT 2
- Inline image example should have img tag in html input HOT 1
- events.ClientInfo is missing the `bot` field HOT 2
- Add 'web_scheme' as a primary attribute to Domain HOT 3
- Set preferred reply method for mailing lists missing HOT 1
- [Feature Request] Add Send Time Optimization (STO) Feature HOT 3
- Ability to add multiple webhooks for same events.
- panic: runtime error: invalid memory address or nil pointer dereference On GetStoredAttachment
- GetMailingList returns empty struct even though address is present HOT 4
- SDK doesn't return errors for email send failures
- Remove dependency on github.com/go-chi/chi/v5 (again)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailgun-go.