Skip to content
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

Improve tests for http executor #936

Merged
merged 1 commit into from
May 13, 2021

Conversation

sysadmind
Copy link
Contributor

While troubleshooting issues with HTTP jobs, I noticed that test cases that I expected to fail, were not causing the test to fail. I dug in and realized that the errors from the output were not being checked. The returned error was being checked, but this is hard coded to nil in the return so it offers very little value.

This adds some common test cases for the HTTP executor and ensures that many input validations return an error and known good configurations work as expected.

This also updates the Dockerfile to go 1.16 because 1.15 does not include go:embed and was causing make test to fail.

New Test Output:

--- PASS: TestExecute (0.03s)
    --- PASS: TestExecute/Expected_200 (0.01s)
    --- PASS: TestExecute/Expected_400 (0.00s)
    --- PASS: TestExecute/Expected_404 (0.00s)
    --- PASS: TestExecute/Unexpected_400_is_error (0.00s)
    --- PASS: TestExecute/Empty_URL_is_error (0.00s)
    --- PASS: TestExecute/Empty_method_is_error (0.00s)
    --- PASS: TestExecute/Expected_GET_Response (0.00s)
    --- PASS: TestExecute/Expected_POST_Response (0.02s)
    --- PASS: TestExecute/Unexpected_POST_Response_is_error (0.00s)

While troubleshooting issues with HTTP jobs, I noticed that test cases that I expected to fail, were not causing the test to fail. I dug in and realilzed that the errors from the output were not being checked. The returned error was being checked, but this is hardcoded to nil in the return so it offers very little value.

This adds some common test cases for the HTTP executor and ensures that many input validations return an error and known good configurations work as expected.

This also updates the Dockerfile to go 1.16 because 1.15 does not include go:embed and was causing `make test` to fail.
Copy link
Member

@vcastellm vcastellm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ thx!

@vcastellm vcastellm merged commit 8af5611 into distribworks:master May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants