MadisonReed / usps-webtools

USPS Web Tools API wrapper
42 stars 37 forks source link

add timeouts #18

Closed BrandonCopley closed 9 years ago

BrandonCopley commented 9 years ago

This feature adds timeouts so that when the url is super slow or down we aren't left waiting over 60 seconds for a callback.

divesnob commented 9 years ago

@BrandonCopley : Can you add some tests for this please?

BrandonCopley commented 9 years ago

I would love too, I don't know how, do you have any good resources for looking into that?

I'll work on looking through your test folder and see what I can do.

On Saturday, November 7, 2015, Matt Darling notifications@github.com wrote:

@BrandonCopley https://github.com/BrandonCopley : Can you add some tests for this please?

— Reply to this email directly or view it on GitHub https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766175 .

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

divesnob commented 9 years ago

Brandon,

You'll want to look into "mocha" as a test framework. As a developer, always write tests for anything you code. If you can't prove to someone that it works consistently time and time again, it doesn't actually work. "It works in my environment" is not valid. :-)

Here's how to get these tests running...

npm install mocha (observe results)

I just ran through the tests myself, and it looks like a few are failing. Seems USPS was down for a number of hours this am. Your suggestion couldn't have been more timely.

Thank you,

-matt

Matt Darling VP Engineering - Madison Reed 415.505.4623

500 Second Street, SF, CA 94107-1404

LIVE LIFE BRILLIANTLY | #BEBRILLIANT | MADISON-REED.com http://madison-reed.com/ Facebook https://www.facebook.com/MadisonReedLLB | Pinterest http://www.pinterest.com/madisonreedllb/ | Instagram http://instagram.com/madisonreedllb | Twitter https://twitter.com/madisonreedllb | Google+ https://plus.google.com/108491753835225258772/posts | LinkedIn http://www.linkedin.com/company/madison-color | YouTube http://www.youtube.com/user/MadisonReedVideos

On Sat, Nov 7, 2015 at 4:06 PM, Brandon Copley notifications@github.com wrote:

I would love too, I don't know how, do you have any good resources for looking into that?

I'll work on looking through your test folder and see what I can do.

On Saturday, November 7, 2015, Matt Darling notifications@github.com wrote:

@BrandonCopley https://github.com/BrandonCopley : Can you add some tests for this please?

— Reply to this email directly or view it on GitHub < https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766175

.

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

— Reply to this email directly or view it on GitHub https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766549 .

BrandonCopley commented 9 years ago

You're absolutely right on the as a dev part, unfortunately I'm not a developer. Used to be, but far before tools like Mocha took over. I just noticed our code was having issues and know enough about API calls to catch which one was failing, and noticed a timeout would be nice for USPS calls.

brandon

On Sat, Nov 7, 2015 at 10:31 PM, Matt Darling notifications@github.com wrote:

Brandon,

You'll want to look into "mocha" as a test framework. As a developer, always write tests for anything you code. If you can't prove to someone that it works consistently time and time again, it doesn't actually work. "It works in my environment" is not valid. :-)

Here's how to get these tests running...

npm install mocha (observe results)

I just ran through the tests myself, and it looks like a few are failing. Seems USPS was down for a number of hours this am. Your suggestion couldn't have been more timely.

Thank you,

-matt

Matt Darling VP Engineering - Madison Reed 415.505.4623

500 Second Street, SF, CA 94107-1404

LIVE LIFE BRILLIANTLY | #BEBRILLIANT | MADISON-REED.com http://madison-reed.com/ Facebook https://www.facebook.com/MadisonReedLLB | Pinterest http://www.pinterest.com/madisonreedllb/ | Instagram http://instagram.com/madisonreedllb | Twitter https://twitter.com/madisonreedllb | Google+ https://plus.google.com/108491753835225258772/posts | LinkedIn http://www.linkedin.com/company/madison-color | YouTube http://www.youtube.com/user/MadisonReedVideos

On Sat, Nov 7, 2015 at 4:06 PM, Brandon Copley notifications@github.com wrote:

I would love too, I don't know how, do you have any good resources for looking into that?

I'll work on looking through your test folder and see what I can do.

On Saturday, November 7, 2015, Matt Darling notifications@github.com wrote:

@BrandonCopley https://github.com/BrandonCopley : Can you add some tests for this please?

— Reply to this email directly or view it on GitHub <

https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766175

.

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

— Reply to this email directly or view it on GitHub < https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766549

.

— Reply to this email directly or view it on GitHub https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154775256 .

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

BrandonCopley commented 9 years ago

More than that, I don't really know how to test the timeout feature, since that requires us to force USPS to timeout which isn't on our end.

On Sat, Nov 7, 2015 at 10:42 PM, Brandon Copley copley.brandon@gmail.com wrote:

You're absolutely right on the as a dev part, unfortunately I'm not a developer. Used to be, but far before tools like Mocha took over. I just noticed our code was having issues and know enough about API calls to catch which one was failing, and noticed a timeout would be nice for USPS calls.

brandon

On Sat, Nov 7, 2015 at 10:31 PM, Matt Darling notifications@github.com wrote:

Brandon,

You'll want to look into "mocha" as a test framework. As a developer, always write tests for anything you code. If you can't prove to someone that it works consistently time and time again, it doesn't actually work. "It works in my environment" is not valid. :-)

Here's how to get these tests running...

npm install mocha (observe results)

I just ran through the tests myself, and it looks like a few are failing. Seems USPS was down for a number of hours this am. Your suggestion couldn't have been more timely.

Thank you,

-matt

Matt Darling VP Engineering - Madison Reed 415.505.4623

500 Second Street, SF, CA 94107-1404

LIVE LIFE BRILLIANTLY | #BEBRILLIANT | MADISON-REED.com http://madison-reed.com/ Facebook https://www.facebook.com/MadisonReedLLB | Pinterest http://www.pinterest.com/madisonreedllb/ | Instagram http://instagram.com/madisonreedllb | Twitter https://twitter.com/madisonreedllb | Google+ https://plus.google.com/108491753835225258772/posts | LinkedIn http://www.linkedin.com/company/madison-color | YouTube http://www.youtube.com/user/MadisonReedVideos

On Sat, Nov 7, 2015 at 4:06 PM, Brandon Copley notifications@github.com wrote:

I would love too, I don't know how, do you have any good resources for looking into that?

I'll work on looking through your test folder and see what I can do.

On Saturday, November 7, 2015, Matt Darling notifications@github.com wrote:

@BrandonCopley https://github.com/BrandonCopley : Can you add some tests for this please?

— Reply to this email directly or view it on GitHub <

https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766175

.

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

— Reply to this email directly or view it on GitHub < https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766549

.

— Reply to this email directly or view it on GitHub https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154775256 .

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

divesnob commented 9 years ago

There's a mocking/stub framework called sinon. I'll pull your changes in and bust out a test and send it over your way for future reference.

Sent from some remote location on Earth.

On Nov 7, 2015, at 8:44 PM, Brandon Copley notifications@github.com wrote:

More than that, I don't really know how to test the timeout feature, since that requires us to force USPS to timeout which isn't on our end.

On Sat, Nov 7, 2015 at 10:42 PM, Brandon Copley copley.brandon@gmail.com wrote:

You're absolutely right on the as a dev part, unfortunately I'm not a developer. Used to be, but far before tools like Mocha took over. I just noticed our code was having issues and know enough about API calls to catch which one was failing, and noticed a timeout would be nice for USPS calls.

brandon

On Sat, Nov 7, 2015 at 10:31 PM, Matt Darling notifications@github.com wrote:

Brandon,

You'll want to look into "mocha" as a test framework. As a developer, always write tests for anything you code. If you can't prove to someone that it works consistently time and time again, it doesn't actually work. "It works in my environment" is not valid. :-)

Here's how to get these tests running...

npm install mocha (observe results)

I just ran through the tests myself, and it looks like a few are failing. Seems USPS was down for a number of hours this am. Your suggestion couldn't have been more timely.

Thank you,

-matt

Matt Darling VP Engineering - Madison Reed 415.505.4623

500 Second Street, SF, CA 94107-1404

LIVE LIFE BRILLIANTLY | #BEBRILLIANT | MADISON-REED.com http://madison-reed.com/ Facebook https://www.facebook.com/MadisonReedLLB | Pinterest http://www.pinterest.com/madisonreedllb/ | Instagram http://instagram.com/madisonreedllb | Twitter https://twitter.com/madisonreedllb | Google+ https://plus.google.com/108491753835225258772/posts | LinkedIn http://www.linkedin.com/company/madison-color | YouTube http://www.youtube.com/user/MadisonReedVideos

On Sat, Nov 7, 2015 at 4:06 PM, Brandon Copley notifications@github.com wrote:

I would love too, I don't know how, do you have any good resources for looking into that?

I'll work on looking through your test folder and see what I can do.

On Saturday, November 7, 2015, Matt Darling notifications@github.com wrote:

@BrandonCopley https://github.com/BrandonCopley : Can you add some tests for this please?

— Reply to this email directly or view it on GitHub <

https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766175

.

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

— Reply to this email directly or view it on GitHub < https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154766549

.

— Reply to this email directly or view it on GitHub https://github.com/MadisonReed/usps-webtools/pull/18#issuecomment-154775256 .

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com

[image: Giftnix]

Brandon Copley

Founder & CEO

t: 512.784.6060

e: copley.brandon@gmail.com — Reply to this email directly or view it on GitHub.