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

#6828 Use json-schema in tests #7419

Closed
wants to merge 2 commits into from

Conversation

original-brownbear
Copy link
Member

@original-brownbear original-brownbear commented Jun 12, 2017

one step for #6828 :)

@ph this is what you had in mind right? (didn't do all specs yet in case the answer is "no" :))

@ph
Copy link
Contributor

ph commented Jun 12, 2017

Yes, but I am wondering if we could have some helper to write the schema?

@original-brownbear
Copy link
Member Author

@ph def, we should dry this up before merging imo. Let me fix the other cases real quick then and see what I can do about that :)

@original-brownbear
Copy link
Member Author

@ph added the remaining cases that I could at reasonable effort port. Two cases, namely:

  context "#values" do

    let(:payload) { LogStash::Json.load(last_response.body) }

    it "return totals of plugins" do
      expect(payload["total"]).to eq(payload["plugins"].count)
    end

    it "return a list of available plugins" do
      payload["plugins"].each do |plugin|
        expect do 
          Gem::Specification.find_by_name(plugin["name"])
        end.not_to raise_error
      end
    end

seem very hard to port since the schema validation has no comparison logic across fields.
I am starting to have some doubts about drying this up though. I think we should be careful here, in a sense we're substituting our own "DSL" for the schema doing that.
When looking at the concrete things we could dry up this seems like it might be more trouble than it's worth in terms of readability?

@original-brownbear
Copy link
Member Author

@ph can you give this another look whenever you find a sec? :)

Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

LGTM, much cleaner.

@elasticsearch-bot
Copy link

Armin Braun merged this into the following branches!

Branch Commits
master 153eea6, a10a7eb

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.

3 participants