fix `ones` and `wecom` integration api test on JH side
FAILED CI JOB: https://jihulab.com/gitlab-cn/gitlab/-/jobs/12614790
in spec/requests/api/integrations_spec.rb
, it use Integration.available_integration_names(include_instance_specific: false)
to loop all integration and trigger shared test group 'set up an integration'
to verify integration rest api, however ones
and wecom
failed due to
ones
ones integration should be disabled if not paid license, we override method project#disabled_integrations
method to hide ones
, however Integration.integration_names
still return ones
, so the tricky things happen
- test will try to run
ones
rest api - method
user_project.find_or_initialize_integration(
_slug
_.underscore)
runs inlib/api/integrations.rb
during the test runs - in method
user_project.find_or_initialize_integration(
_slug
_.underscore)
,ones
is disabled, so the test failed.
wecom
wecom rest api test failed due to 2 reason
-
wecom does not defined rest api endpoint, because method
integrations
andintegration_classes
injh/lib/jh/api/helpers/integrations_helpers.rb
didn't contains any wecom definition. - even we define the api endpoint,
wecom
integration creation will failed dut to 2 validations- miss field `language_for_notify`: because factory_bot integration definition in jh/spec/factories/integrations.rb didn't contain the required field
language_for_notify
- validate method
check_channel_name_format
failed during test run because this method will check propertychannel_names
followWECOM_ROBOT_WEBHOOK_KEY_REGEX
. The tricky things is we can ONLY pass api params according to dsl method `field` in model wecom, which means we cannot modify factory bot definition to passchannel_names
in test.
- miss field `language_for_notify`: because factory_bot integration definition in jh/spec/factories/integrations.rb didn't contain the required field
I think we need more discuss above two errors, not sure we still need pay effort to fix it or disable above two integration rest api endpoint.
由 毛超 编辑于