-
Notifications
You must be signed in to change notification settings - Fork 141
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
Expose MiqEvent/EmsEvent group/levels in event stream OPTIONS #1099
Expose MiqEvent/EmsEvent group/levels in event stream OPTIONS #1099
Conversation
f20fdc5
to
415c536
Compare
@jrafanie I'm wondering if we should nest these options one more level under data. That is, if we need to add something else to OPTIONS in the future, the root of the data payload is taken. Maybe: "data": {
- "EmsEvent": {
+ "event_groups": {
+ "EmsEvent": { (not sure on the name Not sure if the "data" nesting belongs here or in the backend PR. I feel like the backend method should return the hash startng at the "EmsEvent" level, but the API should be the one that constructs the |
415c536
to
1cb57f3
Compare
I agree. I'll nest this in this PR. I like
|
689b0b5
to
cc071d5
Compare
Core PR is merged. |
The 'data' key in the response body can be simple or complex. You can now opt-out of generic data validation in the complex case by not providing the data. This lets you manually validate the data in the specs that know what part of the structure is important, while retaining the rest of the options expectations.
761478c
to
7a2c6de
Compare
expect(body["data"].keys).to eq(["timeline_events"]) | ||
expect(body["data"]["timeline_events"].keys.sort).to eq(%w[EmsEvent MiqEvent]) | ||
expect(body["data"]["timeline_events"]["EmsEvent"].keys.sort).to eq(%w[description group_levels group_names]) | ||
expect(body["data"]["timeline_events"]["EmsEvent"]["group_names"].keys.sort).to include("addition", "other") |
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.
There's no need to test for all of them, just one from the event_handling and the default one "other"
expect(body["data"]["timeline_events"]["EmsEvent"]["group_levels"].keys.sort).to eq(%w[critical detail warning]) | ||
|
||
expect(body["data"]["timeline_events"]["MiqEvent"].keys.sort).to eq(%w[description group_levels group_names]) | ||
expect(body["data"]["timeline_events"]["MiqEvent"]["group_names"].keys.sort).to include("auth_validation", "other") |
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.
same as above
@@ -966,7 +966,7 @@ def create_vms_by_name(names) | |||
describe 'OPTIONS /api/vms' do | |||
it 'returns the options information' do | |||
options(api_vms_url) | |||
expect_options_results(:vms) | |||
expect_options_results(:vms, {}) |
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.
Previously, this method defaulted to {}
so we need to change the one caller that wasn't providing a hash and expected it to be defaulted.
The timeline_events key in the response body 'data' field contains information on the type of events, their descriptions, group levels, group names, etc. Currently, we only support EmsEvent and MiqEvent from event_streams. Part of ManageIQ#1090
7a2c6de
to
83c6c48
Compare
Checked commits jrafanie/manageiq-api@73bcdc2~...83c6c48 with ruby 2.6.3, rubocop 1.13.0, haml-lint 0.35.0, and yamllint |
Part of #1090
Depends on:
OPTIONS http://localhost:3000/api/event_streams
RESPONSE: