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

Test unit added for query method for TemplateFunctions module #39

Merged
merged 1 commit into from
Jan 19, 2023

Conversation

nogazr
Copy link
Contributor

@nogazr nogazr commented Jan 12, 2023

Test Plan

  • Verify the tests are passing

end

it 'renders templates correctly' do
%w[elements.txt more_elements.txt consul_elements.txt more_consul_elements.txt multi_pass.txt query_element.yml].each do |template|
Copy link
Contributor Author

Choose a reason for hiding this comment

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

query_element.yml was added, this one uses the query method to be renderer

@@ -0,0 +1,16 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This query was required to test the method query for TemplateFunctions

@@ -31,3 +31,14 @@ curl \
-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" \
--data $'Aziz! <%= vars[:aziz] %> 🙄\n' \
http://localhost:8500/v1/kv/templates/elements/aziz

curl \
Copy link
Contributor Author

@nogazr nogazr Jan 12, 2023

Choose a reason for hiding this comment

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

We upload a template to use the method query

--data-binary @spec/support/templates/query-test.yml.erb \
http://localhost:8500/v1/kv/templates/db/db1

curl \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this curl we create the query on consul

@@ -0,0 +1,5 @@
configuration:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this template we test the method query for TemplateFunctions

@nogazr nogazr requested a review from a team January 12, 2023 16:18
@nogazr nogazr marked this pull request as ready for review January 12, 2023 16:18
@nogazr nogazr force-pushed the test-consul-query-method branch 3 times, most recently from 28b88b3 to 3d7fb20 Compare January 12, 2023 16:39
Copy link
Contributor

@aharpervc aharpervc left a comment

Choose a reason for hiding this comment

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

LGTM, love it when we add more tests.


To be clear for others, we believe that #37 revealed a bug that is solved by changing the default args from nil to {}, and we also now have better test coverage for that behavior. @nogazr correct?

Copy link

@ronnietaylor ronnietaylor left a comment

Choose a reason for hiding this comment

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

These changes seem good. Prior to merging will you point to this branch in your Rails upgrade pr and make sure you can deploy to staging as a way to validate that template rendering is working in that context?

@nogazr
Copy link
Contributor Author

nogazr commented Jan 12, 2023

LGTM, love it when we add more tests.

To be clear for others, we believe that #37 revealed a bug that is solved by changing the default args from nil to {}, and we also now have better test coverage for that behavior. @nogazr correct?

Yes, that's right! @aharpervc

@nogazr nogazr force-pushed the test-consul-query-method branch from 3d7fb20 to 35eb22b Compare January 12, 2023 18:14
@nogazr nogazr merged commit 4a90ccf into master Jan 19, 2023
@nogazr nogazr deleted the test-consul-query-method branch January 19, 2023 15:19
@nogazr nogazr restored the test-consul-query-method branch January 19, 2023 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants