-
Notifications
You must be signed in to change notification settings - Fork 0
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This query was required to test the method query for TemplateFunctions |
||
"Name": "postgres-client", | ||
"Service": { | ||
"Service": "postgres", | ||
"Failover": { | ||
"NearestN": 0, | ||
"Datacenters": null | ||
}, | ||
"Near": "", | ||
"OnlyPassing": false, | ||
"Tags": ["primary", "!testing"] | ||
}, | ||
"DNS": { | ||
"TTL": "" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
configuration: | ||
node_name: db1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We upload a template to use the method query |
||
--request PUT \ | ||
-H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" \ | ||
--data-binary @spec/support/templates/query-test.yml.erb \ | ||
http://localhost:8500/v1/kv/templates/db/db1 | ||
|
||
curl \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this curl we create the query on consul |
||
--request POST \ | ||
--data @spec/support/consul-query.json \ | ||
http://localhost:8500/v1/query |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
configuration: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this template we test the method query for TemplateFunctions |
||
<%- query('postgres-client').Nodes.each do |node| | ||
node_name = node.dig('Node', 'Node') -%> | ||
node_name: <%= node_name %> | ||
<%- end -%> |
There was a problem hiding this comment.
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