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

add global list record sets endpoint #85

Merged
merged 3 commits into from
Oct 20, 2020

Conversation

jagadeesh545
Copy link
Contributor

@jagadeesh545 jagadeesh545 commented Oct 9, 2020

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions.

Description of the Change

The VinylDNS API has been updated to include a new global recordset search endpoint at /recordsets.

This pull request includes changes required to add the new endpoint as a command to vinyldns-cli. A new command search-record-sets is added to the list of existing commands. This new command requires record-name-filter argument which is a search string with at least two alpha-numeric characters. Other optional arguments include start-from, max-items, record-type-filter, record-group-owner, and name-sort.

The command uses a new method searchRecordSets. This method extracts the given arguments and passes them to the RecordSetsGlobalListAll method, which in turn invokes the /recordsets endpoint. The results will be formatted and returned.

Why Should This Be In The Package?

This change should be included in the package in order to support the newly created global recordset search endpoint /recordsets.

Benefits

This change will allow users to search for recordsets across all zones.

Possible Drawbacks

Since this is a global search it might be resource-intensive. Hence, should be used cautiously.

Verification Process

A new regression test is added in vinyldns_tests.bat to validate the newly added command search-record-sets. The version of vinyldns is updated from 0.9.3 to 0.9.6 as the /recordsets endpoint is missing in 0.9.3 version.
This caused a couple of test cases to fail. Those test cases are also updated to match vinyldns version 0.9.6.

Applicable Issues (Optional)

Fixes #82

Makefile Outdated
@@ -8,7 +8,7 @@ IMG=${DOCKER_NAME}:${VERSION}
LATEST=${DOCKER_NAME}:latest
BATS=github.com/sstephenson/bats
VINYLDNS_REPO=github.com/vinyldns/vinyldns
VINYLDNS_VERSION=0.9.3
VINYLDNS_VERSION=0.9.6

Choose a reason for hiding this comment

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

doesn't matter a whole lot, but since we just released 0.9.7 probably should go there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Updated and tested with 0.9.7.

@pauljamescleary
Copy link

Thanks @jagadeesh545 ! Will see if I can round up the reviews @mdb

@@ -1 +1 @@
[]
"id":"global-acl-group-id","name":"globalACLGroup","email":"email","status":"Active"

Choose a reason for hiding this comment

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

note: i am loosely familiar with this code; however, this file says groups_non_json but you seem to have added a group. Perhaps there is a different figure file that should be used instead?

Same above

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jagadeesh545 Yes; Could you please clarify why the groups fixtures and tests have been modified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There seems to be a default globalACLGroup as part of the local vinyldns docker instance that gets launched as part of testing. Hence, I had to update the fixture to account for this default group.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, thanks for clarifying and apologies for the confusion. This is likely a side effect of updating to VinylDNS 0.9.7. Perhaps @pauljamescleary can offer some insight?

fixture="$(cat tests/fixtures/groups_none)"

[ "${output}" = "${fixture}" ]
$ew groups | grep "${fixture}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jagadeesh545 Just a nitpick: Is there a reason this change -- which impacts the groups tests -- appears in a pull request pertaining to the addition of a search-record-sets command? I just want to be sure I understand :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After updating the fixture to accommodate the default group globalACLGroup, I also had to update to the test case to look for text present in the fixture instead of checking for an exact match.

@@ -1 +1 @@
[]
"id":"global-acl-group-id","name":"globalACLGroup","email":"email","status":"Active"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jagadeesh545 Yes; Could you please clarify why the groups fixtures and tests have been modified?

for record_set in ${record_sets}
do
[[ "${output}" =~ "${record_set}" ]]
done
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks reasonable, though I'm curious to hear a bit more about why you chose to diverge from the established pattern in the other tests where a "fixture" is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the time of writing this test case, I went with a simple way to test. Now the test case is updated to match the established pattern.

@@ -166,6 +159,21 @@ load test_helper
[ "${output}" = "${fixture}" ]
}

@test "search-record-sets" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think it's worth adding something like the following, so this is consistent with the style elsewhere?

Suggested change
@test "search-record-sets" {
@test "search-record-sets (when the search returns results)" {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added suggested context.

Copy link
Collaborator

@mdb mdb left a comment

Choose a reason for hiding this comment

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

Thanks @jagadeesh545!

@mdb mdb merged commit 65eb518 into vinyldns:master Oct 20, 2020
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.

Add RecordSets search support
3 participants