-
Notifications
You must be signed in to change notification settings - Fork 89
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
Filter ec_deployments datasource by tags #248
Conversation
@karencfv (or @marclop perhaps ?!) Unit test
The test asserts that the two Essentiually I have added "tags" to the test model and the HALP ! FYI. I've built and tested the binary....and it seems to work. |
@neiljbrookes I was trying this locally and I think it's due to the amount of nesting in these structures the assert.Equal isn't able to assert those properly, I'm OK +1 this PR, with the current approach since it's what we'll end up sending to the API. I've modified your assertion so that it's easier to read should any errors occur on the test: diff --git a/ec/ecdatasource/deploymentsdatasource/expanders_test.go b/ec/ecdatasource/deploymentsdatasource/expanders_test.go
index a3e8d98..3636f92 100644
--- a/ec/ecdatasource/deploymentsdatasource/expanders_test.go
+++ b/ec/ecdatasource/deploymentsdatasource/expanders_test.go
@@ -82,17 +82,17 @@ func Test_expandFilters(t *testing.T) {
assert.NoError(t, err)
}
- jsonWant, err := json.Marshal(tt.want)
+ jsonWant, err := json.MarshalIndent(tt.want, "", " ")
if err != nil {
t.Error("Unable to marshal wanted struct to JSON")
}
- jsonGot, err := json.Marshal(got)
+
+ jsonGot, err := json.MarshalIndent(got, "", " ")
if err != nil {
t.Error("Unable to marshal received struct to JSON")
}
- assert.Equal(t, jsonWant, jsonGot)
-
+ assert.Equal(t, string(jsonWant), string(jsonGot))
})
}
}
|
oops I set the PR as ready for review. I think that was premature since the integration tests haven't been written yet. |
Co-authored-by: Marc Lopez Rubio <[email protected]>
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.
LGTM
acceptance failures are unrelated to the changes. |
Description
This PR attempts to allow filtering by "tags" when using the
ec_deployments
datasource.For example:
.... where
10974c2d7136235d8fe88be9545a8d22
is tagged with{ "foo" = "bar"}
and is elasticsearch-healthy !Related Issues
Closes #182
Motivation and Context
How Has This Been Tested?
Test_expandFilters
extended to include "tags".TestAccDatasource_basic_tags
extended to includeec_depoyments
datasource filtering on tags.Types of Changes
Readiness Checklist