foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Fixes #32685 - update graphql to 1.13.0+

Open evgeni opened this issue 3 years ago • 9 comments

evgeni avatar May 23 '22 08:05 evgeni

Issues: #32685

theforeman-bot avatar May 23 '22 08:05 theforeman-bot

@timogoebel @kamils-iRonin ohai, I recall y'all have poked around GraphQL in the past. Would you mind having a look at the errors and tell me WTH I am doing wrong?

To save you some clicks:

Failure:
Queries::HostQueryTest::with user without view_models permission#test_0001_does not load associated model [/home/jenkins/workspace/test_develop_pr_core/database/postgresql/ruby/2.7/slave/fast/test/graphql/queries/host_query_test.rb:156]
Minitest::Assertion: Expected {"id"=>"MDE6TW9kZWwtOTgwMTkwOTY5"} to be nil.

Failure:
Queries::NodesQueryTest::as user without view_models permission#test_0001_does not fetch the record [/home/jenkins/workspace/test_develop_pr_core/database/postgresql/ruby/2.7/slave/fast/test/graphql/queries/nodes_query_test.rb:71]
Minitest::Assertion: Expected [{"message"=>"Argument 'id' on Field 'node' has an invalid value (MDE6TW9kZWwtOTgwMTkwOTgw). Expected type 'ID!'.", "locations"=>[{"line"=>2, "column"=>9}], "path"=>["query getNode", "node", "id"], "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"id"}}] to be empty.

Failure:
Queries::NodesQueryTest#test_0001_fetching node by relay global id [/home/jenkins/workspace/test_develop_pr_core/database/postgresql/ruby/2.7/slave/fast/test/graphql/queries/nodes_query_test.rb:27]
Minitest::Assertion: Expected [{"message"=>"Argument 'id' on Field 'node' has an invalid value (MDE6TW9kZWwtOTgwMTkwOTg1). Expected type 'ID!'.", "locations"=>[{"line"=>2, "column"=>9}], "path"=>["query getNode", "node", "id"], "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"id"}}] to be empty.

Failure:
Queries::NodesQueryTest#test_0002_fetching multiple nodes by relay global id [/home/jenkins/workspace/test_develop_pr_core/database/postgresql/ruby/2.7/slave/fast/test/graphql/queries/nodes_query_test.rb:50]
Minitest::Assertion: Expected [{"message"=>"Argument 'ids' on Field 'nodes' has an invalid value ([MDE6TW9kZWwtOTgwMTkwOTg2]). Expected type '[ID!]!'.", "locations"=>[{"line"=>2, "column"=>9}], "path"=>["query getNodes", "nodes", "ids"], "extensions"=>{"code"=>"argumentLiteralsIncompatible", "typeName"=>"Field", "argumentName"=>"ids"}}] to be empty.

evgeni avatar May 24 '22 10:05 evgeni

@evgeni Thanks for the effort! I was stumbling across this for foreman_puppet, yesterday. Would be nice to mark this PR with the Breaking change label, I suppose :)

nadjaheitmann avatar Jun 02 '22 10:06 nadjaheitmann

@nadjaheitmann why would this be a breaking change?

evgeni avatar Jun 02 '22 10:06 evgeni

@evgeni Because it would update the graphql gem and plugins need to update their graphql as well if they support it

nadjaheitmann avatar Jun 02 '22 10:06 nadjaheitmann

Ah, that way round. Yeah, indeed!

evgeni avatar Jun 02 '22 10:06 evgeni

@evgeni Thanks! I find that label quite useful for plugin maintainers :)

nadjaheitmann avatar Jun 02 '22 10:06 nadjaheitmann

rebased, not that it'll pass tests or anything now, but rebased :)

evgeni avatar Aug 26 '22 16:08 evgeni

Yay, thanks to @ofedoren the tests are green!

Katello failure is related tho ;)

evgeni avatar Sep 15 '22 15:09 evgeni

@ofedoren any idea how to solve the Katello side?

ekohl avatar Sep 22 '22 11:09 ekohl

@ofedoren any idea how to solve the Katello side?

I guess? Let's see if the tests will pass now.

But anyway, this update will break other plugin tests, e.g. foreman_ansible. Hopefully the tests only...

ofedoren avatar Sep 26 '22 14:09 ofedoren

I've added https://github.com/theforeman/foreman/pull/9230/commits/6b557cf4ee7a600dce03fe24079b70c6d0cb1a5a as a solution/workaround for custom names of the types. We do that in plugins since our models/types are scoped by plugin's name. Unfortunatelly the name can't contain :: and our main "hack" [1] does no longer works [2].

[1] - https://github.com/Katello/katello/blob/master/app/graphql/types/host_collection.rb#L14-L16 This also is present in other plugins, but this can be safely removed after the library is updated. Just dead code. [2] - https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md#1131-13-december-2021

ofedoren avatar Sep 27 '22 15:09 ofedoren

:green_apple:

ofedoren avatar Sep 27 '22 15:09 ofedoren