-
Notifications
You must be signed in to change notification settings - Fork 428
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
GraphQL Admin CLI PoC #3701
GraphQL Admin CLI PoC #3701
Conversation
small_tests_24 / small_tests / 71e192a small_tests_25 / small_tests / 71e192a dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} ldap_mnesia_24 / ldap_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} service_mongoose_system_metrics_SUITE:module_opts:module_opts_are_reported{error,
{{assertEqual,
[{module,service_mongoose_system_metrics_SUITE},
{line,372},
{expression,"is_module_opt_reported ( Module , Key , Value )"},
{expected,true},
{value,false}]},
[{service_mongoose_system_metrics_SUITE,check_module_opt,3,
[{file,
"/home/circleci/project/big_tests/tests/service_mongoose_system_metrics_SUITE.erl"},
{line,372}]},
{service_mongoose_system_metrics_SUITE,module_opts_are_reported,1,
[{file,
"/home/circleci/project/big_tests/tests/service_mongoose_system_metrics_SUITE.erl"},
{line,224}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} dynamic_domains_mysql_redis_25 / mysql_redis / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} ldap_mnesia_25 / ldap_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} pgsql_mnesia_24 / pgsql_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} internal_mnesia_25 / internal_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} pgsql_mnesia_25 / pgsql_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} mysql_redis_25 / mysql_redis / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} riak_mnesia_24 / riak_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} mssql_mnesia_25 / odbc_mssql_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 71e192a mongooseimctl_SUITE:graphql:can_handle_execution_error{error,{{assertMatch,[{module,mongooseimctl_SUITE},
{line,1134},
{expression,"Res"},
{pattern,"{ _ , 0 }"},
{value,{"{error,#{error_term =>\n {parser_error,{1,graphql_parser,[\"syntax error before: \",\"'}'\"]}},\n path => [],phase => parse}}\n",
1}}]},
[{mongooseimctl_SUITE,can_handle_execution_error,1,
[{file,"/home/circleci/project/big_tests/tests/mongooseimctl_SUITE.erl"},
{line,1134}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} |
Codecov Report
@@ Coverage Diff @@
## master #3701 +/- ##
==========================================
+ Coverage 82.10% 82.18% +0.07%
==========================================
Files 513 514 +1
Lines 33644 33716 +72
==========================================
+ Hits 27624 27709 +85
+ Misses 6020 6007 -13
Continue to review full report at Codecov.
|
71e192a
to
3af8e6a
Compare
small_tests_24 / small_tests / 3af8e6a small_tests_25 / small_tests / 3af8e6a dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 3af8e6a dynamic_domains_mysql_redis_25 / mysql_redis / 3af8e6a dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 3af8e6a ldap_mnesia_25 / ldap_mnesia / 3af8e6a dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 3af8e6a muc_SUITE:register:user_submits_registration_form{error,
{{assertion_failed,assert,is_iq_result,
[{xmlel,<<"iq">>,
[{<<"type">>,<<"set">>},
{<<"id">>,<<"e269915f694d2244cc4be73043257fc5">>},
{<<"to">>,<<"groupchats.domain.example.com">>}],
[{xmlel,<<"query">>,
[{<<"xmlns">>,<<"jabber:iq:register">>}],
[{xmlel,<<"x">>,
[{<<"xmlns">>,<<"jabber:x:data">>},
{<<"type">>,<<"submit">>}],
[{xmlel,<<"field">>,
[{<<"type">>,<<"hidden">>},
{<<"var">>,<<"FORM_TYPE">>}],
[{xmlel,<<"value">>,[],
[{xmlcdata,<<"jabber:iq:register">>}]}]},
{xmlel,<<"field">>,
[{<<"type">>,<<"text-single">>},
{<<"var">>,<<"nick">>}],
[{xmlel,<<"value">>,[],
[{xmlcdata,
<<"thirdwitchroom-2f90ba090a">>}]}]}]}]}]}],
{xmlel,<<"iq">>,
[{<<"from">>,<<"groupchats.domain.example.com">>},
{<<"to">>,
<<"[email protected]/res1">>},
{<<"type">>,<<"error">>},
{<<"xml:lang">>,<<"en">>},
{<<"id">>,<<"e269915f694d2244cc4be73043257fc5">>}],
[{xmlel,<<"query">>,
[{<<"xmlns">>,<<"jabber:iq:register">>}],
[{xmlel,<<"x">>,
[{<<"xmlns">>,<<"jabber:x:data">>},
{<<"type">>,<<"submit">>}],
[{xmlel,<<"field">>,
[{<<"type">>,<<"hidden">>},
{... pgsql_mnesia_24 / pgsql_mnesia / 3af8e6a internal_mnesia_25 / internal_mnesia / 3af8e6a pgsql_mnesia_25 / pgsql_mnesia / 3af8e6a ldap_mnesia_24 / ldap_mnesia / 3af8e6a mod_ping_SUITE:server_ping:server_ping_pong{error,{{badmatch,[{[<<"localhost">>,mod_ping,ping_response],
{expected_diff,5},
{before_story,0},
{after_story,4}}]},
[{escalus_mongooseim,post_story_check_metrics,1,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_mongooseim.erl"},
{line,74}]},
{escalus_mongooseim,maybe_check_metrics_post_story,1,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_mongooseim.erl"},
{line,51}]},
{escalus_story,story,4,
[{file,"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,75}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1292}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1224}]}]}} mysql_redis_25 / mysql_redis / 3af8e6a pep_SUITE:pep_tests:unsubscribe_after_presence_unsubscription{error,
{{badmatch,
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_unsubscribe_after_presence_unsubscription_2081@localhost">>},
{<<"to">>,
<<"bob_unsubscribe_after_presence_unsubscription_2081@localhost/res1">>},
{<<"type">>,<<"headline">>}],
[{xmlel,<<"event">>,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/pubsub#event">>}],
[{xmlel,<<"items">>,
[{<<"node">>,<<"hkwjmSJP8oqqdi9V8R2S7Q==">>}],
[{xmlel,<<"item">>,
[{<<"id">>,<<"salmon">>}],
[{xmlel,<<"entry">>,
[{<<"xmlns">>,
<<"http://www.w3.org/2005/Atom">>}],
[]}]}]}]},
{xmlel,<<"headers">>,
[{<<"xmlns">>,<<"http://jabber.org/protocol/shim">>}],
[]}]}]},
[{pep_SUITE,'-unsubscribe_after_presence_unsubscription/1-fun-0-',2,
[{file,"/home/circleci/project/big_tests/tests/pep_SUITE.erl"},
{line,384}]},
{escalus_story,story,4,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,72}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
{test_server,run_test_case_eval1,6,
[{file,"test_server.erl"},{line,1291}]},
{test_server,run_test_case_eval,9,
[{file,"test_server.erl"},{line,1223}]}]}} riak_mnesia_24 / riak_mnesia / 3af8e6a mssql_mnesia_25 / odbc_mssql_mnesia / 3af8e6a |
- Use introspection to gather all possible commands - Generate query docs and store them in a persistent term
3af8e6a
to
2b49ec4
Compare
small_tests_24 / small_tests / 2b49ec4 small_tests_25 / small_tests / 2b49ec4 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 2b49ec4 ldap_mnesia_24 / ldap_mnesia / 2b49ec4 dynamic_domains_mysql_redis_25 / mysql_redis / 2b49ec4 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 2b49ec4 ldap_mnesia_25 / ldap_mnesia / 2b49ec4 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 2b49ec4 internal_mnesia_25 / internal_mnesia / 2b49ec4 elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 2b49ec4 pgsql_mnesia_25 / pgsql_mnesia / 2b49ec4 mysql_redis_25 / mysql_redis / 2b49ec4 riak_mnesia_24 / riak_mnesia / 2b49ec4 mssql_mnesia_25 / odbc_mssql_mnesia / 2b49ec4 |
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.
Fantastic that it's possible to build queries dynamically 😀 I like the idea of using introspection. I forgot about this possibility.
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.
👌🏻
@@ -7,7 +7,7 @@ | |||
-spec input(Type, Value) -> {ok, Coerced} | {error, Reason} | |||
when | |||
Type :: binary(), | |||
Value :: binary(), | |||
Value :: binary() | pos_integer(), |
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.
I think here we can have more types here. Any value passed as a scalar is verified in this function. Thus it can be also an integer, float, bool, etc.
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.
That's right, and I think that Value
and Coerced
types should be swapped for output
vs input
?
A Proof of Concept of an Admin API that wraps the GraphQL API and can fully replace the current CLI implementation (
admin_extra
+ejabberd_commands
).Key points:
graphql_*
modules are not used directly, because code code would get tightly coupled with the implementation of GraphQL, and it wouldn't be possible to switch to another GraphQL library.iolist
concatenation) - it seems that this is enough for now.Not included in this PoC:
graphql_*_SUITE
), and/or have some commands tested end-to-end (withmongooseimctl
).admin_extra
andejabberd_commands
.getMetrics
command. It is possible, but since the syntax is complex, the code would get more complicated as well.Examples: