Skip to content

Fix pg12 and pg13 builds

mo khan requested to merge mokhax/fix-pg-12-build into master

What does this MR do and why?

This change attempts to fix a defect that occurs when running pg12 or pg13. Introduced in !133904 (merged).

gitlab-org/quality/engineering-productivity/master-broken-incidents#3865 (closed)

Before:

~/src/gitlab.com/gitlab-org/gitlab-development-kit/gitlab [mokhax/fix-pg-12-build]
モ bundle exec rspec ee/spec/finders/sbom/dependency_licenses_finder_spec.rb ee/spec/requests/groups/dependencies_controller_spec.rb

          ██     ██  █████  ██████  ███    ██ ██ ███    ██  ██████ 
          ██     ██ ██   ██ ██   ██ ████   ██ ██ ████   ██ ██      
          ██  █  ██ ███████ ██████  ██ ██  ██ ██ ██ ██  ██ ██   ███ 
          ██ ███ ██ ██   ██ ██   ██ ██  ██ ██ ██ ██  ██ ██ ██    ██ 
           ███ ███  ██   ██ ██   ██ ██   ████ ██ ██   ████  ██████  

******************************************************************************
  You are using PostgreSQL 12.16 for the main database, but this version of GitLab requires PostgreSQL >= 13.

  If using gitlab-development-kit, please find the relevant steps here:
    https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md#upgrade-postgresql

  Please upgrade your environment to a supported PostgreSQL version. See
  https://docs.gitlab.com/ee/install/requirements.html#database for details.
******************************************************************************


          ██     ██  █████  ██████  ███    ██ ██ ███    ██  ██████ 
          ██     ██ ██   ██ ██   ██ ████   ██ ██ ████   ██ ██      
          ██  █  ██ ███████ ██████  ██ ██  ██ ██ ██ ██  ██ ██   ███ 
          ██ ███ ██ ██   ██ ██   ██ ██  ██ ██ ██ ██  ██ ██ ██    ██ 
           ███ ███  ██   ██ ██   ██ ██   ████ ██ ██   ████  ██████  

******************************************************************************
  You are using PostgreSQL 12.16 for the ci database, but this version of GitLab requires PostgreSQL >= 13.

  If using gitlab-development-kit, please find the relevant steps here:
    https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md#upgrade-postgresql

  Please upgrade your environment to a supported PostgreSQL version. See
  https://docs.gitlab.com/ee/install/requirements.html#database for details.
******************************************************************************

Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Test environment set up in 0.954799114 seconds
FF...............................FFF...

Failures:

  1) Sbom::DependencyLicensesFinder#execute returns all detected licenses
     Failure/Error: connection.public_send(...)

     ActiveRecord::StatementInvalid:
       PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
       LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
                                                                    ^
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:107:in `public_send'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:107:in `block in read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:137:in `block in read_write'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:224:in `retry_with_backoff'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:126:in `read_write'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:106:in `read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:48:in `select_all'
     # ./ee/app/models/ee/group.rb:883:in `sbom_licenses'
     # ./ee/app/finders/sbom/dependency_licenses_finder.rb:13:in `execute'
     # ./ee/spec/finders/sbom/dependency_licenses_finder_spec.rb:22:in `block (3 levels) in <top (required)>'
     # ./ee/spec/finders/sbom/dependency_licenses_finder_spec.rb:25:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:439:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:430:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:426:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:66:in `with_raw_context'
     # ./spec/spec_helper.rb:426:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
     # ------------------
     # --- Caused by: ---
     # PG::InvalidColumnReference:
     #   ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
     #   LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
     #                                                                ^
     #   ./lib/gitlab/database/load_balancing/connection_proxy.rb:107:in `public_send'

  2) Sbom::DependencyLicensesFinder#execute with more than the maximum unique licenses returns the maximum licenses
     Failure/Error: connection.public_send(...)

     ActiveRecord::StatementInvalid:
       PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
       LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
                                                                    ^
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:107:in `public_send'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:107:in `block in read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:137:in `block in read_write'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:224:in `retry_with_backoff'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:126:in `read_write'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:106:in `read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:48:in `select_all'
     # ./ee/app/models/ee/group.rb:883:in `sbom_licenses'
     # ./ee/app/finders/sbom/dependency_licenses_finder.rb:13:in `execute'
     # ./ee/spec/finders/sbom/dependency_licenses_finder_spec.rb:22:in `block (3 levels) in <top (required)>'
     # ./ee/spec/finders/sbom/dependency_licenses_finder_spec.rb:61:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:439:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:430:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:426:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:66:in `with_raw_context'
     # ./spec/spec_helper.rb:426:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
     # ------------------
     # --- Caused by: ---
     # PG::InvalidColumnReference:
     #   ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
     #   LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
     #                                                                ^
     #   ./lib/gitlab/database/load_balancing/connection_proxy.rb:107:in `public_send'

  3) Groups::DependenciesController GET #licenses when security dashboard feature is enabled and user is allowed to access group level dependencies returns http status :ok
     Failure/Error: connection.public_send(...)

     ActiveRecord::StatementInvalid:
       PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
       LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
                                                                    ^
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `public_send'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `block in read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:63:in `read'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:110:in `read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:48:in `select_all'
     # ./ee/app/models/ee/group.rb:883:in `sbom_licenses'
     # ./ee/app/finders/sbom/dependency_licenses_finder.rb:13:in `execute'
     # ./ee/app/controllers/groups/dependencies_controller.rb:47:in `licenses'
     # ./ee/lib/gitlab/ip_address_state.rb:10:in `with'
     # ./ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'
     # ./lib/gitlab/auth/current_user_mode.rb:72:in `with_current_admin'
     # ./app/controllers/application_controller.rb:501:in `set_current_admin'
     # ./lib/gitlab/session.rb:11:in `with_session'
     # ./app/controllers/application_controller.rb:489:in `set_session_storage'
     # ./lib/gitlab/i18n.rb:107:in `with_locale'
     # ./lib/gitlab/i18n.rb:113:in `with_user_locale'
     # ./app/controllers/application_controller.rb:480:in `set_locale'
     # ./app/controllers/application_controller.rb:473:in `set_current_context'
     # ./lib/gitlab/middleware/memory_report.rb:13:in `call'
     # ./lib/gitlab/middleware/speedscope.rb:13:in `call'
     # ./lib/gitlab/query_limiting/middleware.rb:17:in `block in call'
     # ./lib/gitlab/query_limiting/transaction.rb:45:in `run'
     # ./lib/gitlab/query_limiting/middleware.rb:16:in `call'
     # ./lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'
     # ./lib/gitlab/jira/middleware.rb:19:in `call'
     # ./lib/gitlab/middleware/go.rb:20:in `call'
     # ./lib/gitlab/etag_caching/middleware.rb:21:in `call'
     # ./lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'
     # ./lib/gitlab/database/query_analyzer.rb:37:in `within'
     # ./lib/gitlab/middleware/query_analyzer.rb:11:in `call'
     # ./lib/gitlab/middleware/multipart.rb:173:in `call'
     # ./lib/gitlab/middleware/read_only/controller.rb:50:in `call'
     # ./lib/gitlab/middleware/read_only.rb:18:in `call'
     # ./lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
     # ./lib/gitlab/middleware/path_traversal_check.rb:25:in `call'
     # ./lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
     # ./lib/gitlab/middleware/basic_health_check.rb:25:in `call'
     # ./lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
     # ./lib/gitlab/middleware/request_context.rb:15:in `call'
     # ./lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'
     # ./config/initializers/fix_local_cache_middleware.rb:11:in `call'
     # ./lib/gitlab/middleware/compressed_json.rb:44:in `call'
     # ./lib/gitlab/middleware/static.rb:11:in `call'
     # ./lib/gitlab/webpack/dev_server_middleware.rb:34:in `perform_request'
     # ./lib/gitlab/testing/clear_process_memory_cache_middleware.rb:13:in `call'
     # ./lib/gitlab/testing/request_inspector_middleware.rb:35:in `call'
     # ./lib/gitlab/testing/robots_blocker_middleware.rb:30:in `call'
     # ./lib/gitlab/testing/request_blocker_middleware.rb:47:in `call'
     # ./lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'
     # ./lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'
     # ./lib/gitlab/metrics/requests_rack_middleware.rb:79:in `call'
     # ./ee/spec/requests/groups/dependencies_controller_spec.rb:456:in `block (3 levels) in <main>'
     # ./ee/spec/requests/groups/dependencies_controller_spec.rb:469:in `block (5 levels) in <main>'
     # ./spec/spec_helper.rb:439:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:430:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:426:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:66:in `with_raw_context'
     # ./spec/spec_helper.rb:426:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
     # ------------------
     # --- Caused by: ---
     # PG::InvalidColumnReference:
     #   ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
     #   LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
     #                                                                ^
     #   ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `public_send'

  4) Groups::DependenciesController GET #licenses when security dashboard feature is enabled and user is allowed to access group level dependencies returns empty array
     Failure/Error: connection.public_send(...)

     ActiveRecord::StatementInvalid:
       PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
       LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
                                                                    ^
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `public_send'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `block in read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:63:in `read'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:110:in `read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:48:in `select_all'
     # ./ee/app/models/ee/group.rb:883:in `sbom_licenses'
     # ./ee/app/finders/sbom/dependency_licenses_finder.rb:13:in `execute'
     # ./ee/app/controllers/groups/dependencies_controller.rb:47:in `licenses'
     # ./ee/lib/gitlab/ip_address_state.rb:10:in `with'
     # ./ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'
     # ./lib/gitlab/auth/current_user_mode.rb:72:in `with_current_admin'
     # ./app/controllers/application_controller.rb:501:in `set_current_admin'
     # ./lib/gitlab/session.rb:11:in `with_session'
     # ./app/controllers/application_controller.rb:489:in `set_session_storage'
     # ./lib/gitlab/i18n.rb:107:in `with_locale'
     # ./lib/gitlab/i18n.rb:113:in `with_user_locale'
     # ./app/controllers/application_controller.rb:480:in `set_locale'
     # ./app/controllers/application_controller.rb:473:in `set_current_context'
     # ./lib/gitlab/middleware/memory_report.rb:13:in `call'
     # ./lib/gitlab/middleware/speedscope.rb:13:in `call'
     # ./lib/gitlab/query_limiting/middleware.rb:17:in `block in call'
     # ./lib/gitlab/query_limiting/transaction.rb:45:in `run'
     # ./lib/gitlab/query_limiting/middleware.rb:16:in `call'
     # ./lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'
     # ./lib/gitlab/jira/middleware.rb:19:in `call'
     # ./lib/gitlab/middleware/go.rb:20:in `call'
     # ./lib/gitlab/etag_caching/middleware.rb:21:in `call'
     # ./lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'
     # ./lib/gitlab/database/query_analyzer.rb:37:in `within'
     # ./lib/gitlab/middleware/query_analyzer.rb:11:in `call'
     # ./lib/gitlab/middleware/multipart.rb:173:in `call'
     # ./lib/gitlab/middleware/read_only/controller.rb:50:in `call'
     # ./lib/gitlab/middleware/read_only.rb:18:in `call'
     # ./lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
     # ./lib/gitlab/middleware/path_traversal_check.rb:25:in `call'
     # ./lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
     # ./lib/gitlab/middleware/basic_health_check.rb:25:in `call'
     # ./lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
     # ./lib/gitlab/middleware/request_context.rb:15:in `call'
     # ./lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'
     # ./config/initializers/fix_local_cache_middleware.rb:11:in `call'
     # ./lib/gitlab/middleware/compressed_json.rb:44:in `call'
     # ./lib/gitlab/middleware/static.rb:11:in `call'
     # ./lib/gitlab/webpack/dev_server_middleware.rb:34:in `perform_request'
     # ./lib/gitlab/testing/clear_process_memory_cache_middleware.rb:13:in `call'
     # ./lib/gitlab/testing/request_inspector_middleware.rb:35:in `call'
     # ./lib/gitlab/testing/robots_blocker_middleware.rb:30:in `call'
     # ./lib/gitlab/testing/request_blocker_middleware.rb:47:in `call'
     # ./lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'
     # ./lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'
     # ./lib/gitlab/metrics/requests_rack_middleware.rb:79:in `call'
     # ./ee/spec/requests/groups/dependencies_controller_spec.rb:456:in `block (3 levels) in <main>'
     # ./ee/spec/requests/groups/dependencies_controller_spec.rb:475:in `block (5 levels) in <main>'
     # ./spec/spec_helper.rb:439:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:430:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:426:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:66:in `with_raw_context'
     # ./spec/spec_helper.rb:426:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
     # ------------------
     # --- Caused by: ---
     # PG::InvalidColumnReference:
     #   ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
     #   LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
     #                                                                ^
     #   ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `public_send'

  5) Groups::DependenciesController GET #licenses when security dashboard feature is enabled and user is allowed to access group level dependencies with detected licenses returns the list of detected licenses
     Failure/Error: connection.public_send(...)

     ActiveRecord::StatementInvalid:
       PG::InvalidColumnReference: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
       LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
                                                                    ^
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `public_send'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `block in read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/load_balancer.rb:63:in `read'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:110:in `read_using_load_balancer'
     # ./lib/gitlab/database/load_balancing/connection_proxy.rb:48:in `select_all'
     # ./ee/app/models/ee/group.rb:883:in `sbom_licenses'
     # ./ee/app/finders/sbom/dependency_licenses_finder.rb:13:in `execute'
     # ./ee/app/controllers/groups/dependencies_controller.rb:47:in `licenses'
     # ./ee/lib/gitlab/ip_address_state.rb:10:in `with'
     # ./ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'
     # ./lib/gitlab/auth/current_user_mode.rb:72:in `with_current_admin'
     # ./app/controllers/application_controller.rb:501:in `set_current_admin'
     # ./lib/gitlab/session.rb:11:in `with_session'
     # ./app/controllers/application_controller.rb:489:in `set_session_storage'
     # ./lib/gitlab/i18n.rb:107:in `with_locale'
     # ./lib/gitlab/i18n.rb:113:in `with_user_locale'
     # ./app/controllers/application_controller.rb:480:in `set_locale'
     # ./app/controllers/application_controller.rb:473:in `set_current_context'
     # ./lib/gitlab/middleware/memory_report.rb:13:in `call'
     # ./lib/gitlab/middleware/speedscope.rb:13:in `call'
     # ./lib/gitlab/query_limiting/middleware.rb:17:in `block in call'
     # ./lib/gitlab/query_limiting/transaction.rb:45:in `run'
     # ./lib/gitlab/query_limiting/middleware.rb:16:in `call'
     # ./lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'
     # ./lib/gitlab/jira/middleware.rb:19:in `call'
     # ./lib/gitlab/middleware/go.rb:20:in `call'
     # ./lib/gitlab/etag_caching/middleware.rb:21:in `call'
     # ./lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'
     # ./lib/gitlab/database/query_analyzer.rb:37:in `within'
     # ./lib/gitlab/middleware/query_analyzer.rb:11:in `call'
     # ./lib/gitlab/middleware/multipart.rb:173:in `call'
     # ./lib/gitlab/middleware/read_only/controller.rb:50:in `call'
     # ./lib/gitlab/middleware/read_only.rb:18:in `call'
     # ./lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
     # ./lib/gitlab/middleware/path_traversal_check.rb:25:in `call'
     # ./lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
     # ./lib/gitlab/middleware/basic_health_check.rb:25:in `call'
     # ./lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
     # ./lib/gitlab/middleware/request_context.rb:15:in `call'
     # ./lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'
     # ./config/initializers/fix_local_cache_middleware.rb:11:in `call'
     # ./lib/gitlab/middleware/compressed_json.rb:44:in `call'
     # ./lib/gitlab/middleware/static.rb:11:in `call'
     # ./lib/gitlab/webpack/dev_server_middleware.rb:34:in `perform_request'
     # ./lib/gitlab/testing/clear_process_memory_cache_middleware.rb:13:in `call'
     # ./lib/gitlab/testing/request_inspector_middleware.rb:35:in `call'
     # ./lib/gitlab/testing/robots_blocker_middleware.rb:30:in `call'
     # ./lib/gitlab/testing/request_blocker_middleware.rb:47:in `call'
     # ./lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'
     # ./lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'
     # ./lib/gitlab/metrics/requests_rack_middleware.rb:79:in `call'
     # ./ee/spec/requests/groups/dependencies_controller_spec.rb:456:in `block (3 levels) in <main>'
     # ./ee/spec/requests/groups/dependencies_controller_spec.rb:507:in `block (6 levels) in <main>'
     # ./spec/spec_helper.rb:439:in `block (3 levels) in <top (required)>'
     # ./spec/support/sidekiq_middleware.rb:18:in `with_sidekiq_server_middleware'
     # ./spec/spec_helper.rb:430:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:426:in `block (3 levels) in <top (required)>'
     # ./lib/gitlab/application_context.rb:66:in `with_raw_context'
     # ./spec/spec_helper.rb:426:in `block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:266:in `block (2 levels) in <top (required)>'
     # ./spec/support/system_exit_detected.rb:7:in `block (2 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (3 levels) in <main>'
     # ./spec/support/database/prevent_cross_joins.rb:60:in `with_cross_joins_prevented'
     # ./spec/support/database/prevent_cross_joins.rb:106:in `block (2 levels) in <main>'
     # ------------------
     # --- Caused by: ---
     # PG::InvalidColumnReference:
     #   ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list
     #   LINE 1: ..._licenses"."spdx_identifier" IS NOT NULL ORDER BY sbom_licen...
     #                                                                ^
     #   ./lib/gitlab/database/load_balancing/connection_proxy.rb:111:in `public_send'

Finished in 26.23 seconds (files took 12.83 seconds to load)
39 examples, 5 failures

Failed examples:

rspec ./ee/spec/finders/sbom/dependency_licenses_finder_spec.rb:24 # Sbom::DependencyLicensesFinder#execute returns all detected licenses
rspec ./ee/spec/finders/sbom/dependency_licenses_finder_spec.rb:60 # Sbom::DependencyLicensesFinder#execute with more than the maximum unique licenses returns the maximum licenses
rspec ./ee/spec/requests/groups/dependencies_controller_spec.rb:468 # Groups::DependenciesController GET #licenses when security dashboard feature is enabled and user is allowed to access group level dependencies returns http status :ok
rspec ./ee/spec/requests/groups/dependencies_controller_spec.rb:474 # Groups::DependenciesController GET #licenses when security dashboard feature is enabled and user is allowed to access group level dependencies returns empty array
rspec ./ee/spec/requests/groups/dependencies_controller_spec.rb:506 # Groups::DependenciesController GET #licenses when security dashboard feature is enabled and user is allowed to access group level dependencies with detected licenses returns the list of detected licenses

Randomized with seed 5161

[TEST PROF INFO] Time spent in factories: 00:09.054 (32.52% of total time)

After:

~/src/gitlab.com/gitlab-org/gitlab-development-kit/gitlab [mokhax/fix-pg-12-build]
モ bundle exec rspec ee/spec/finders/sbom/dependency_licenses_finder_spec.rb ee/spec/requests/groups/dependencies_controller_spec.rb

          ██     ██  █████  ██████  ███    ██ ██ ███    ██  ██████ 
          ██     ██ ██   ██ ██   ██ ████   ██ ██ ████   ██ ██      
          ██  █  ██ ███████ ██████  ██ ██  ██ ██ ██ ██  ██ ██   ███ 
          ██ ███ ██ ██   ██ ██   ██ ██  ██ ██ ██ ██  ██ ██ ██    ██ 
           ███ ███  ██   ██ ██   ██ ██   ████ ██ ██   ████  ██████  

******************************************************************************
  You are using PostgreSQL 12.16 for the main database, but this version of GitLab requires PostgreSQL >= 13.

  If using gitlab-development-kit, please find the relevant steps here:
    https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md#upgrade-postgresql

  Please upgrade your environment to a supported PostgreSQL version. See
  https://docs.gitlab.com/ee/install/requirements.html#database for details.
******************************************************************************


          ██     ██  █████  ██████  ███    ██ ██ ███    ██  ██████ 
          ██     ██ ██   ██ ██   ██ ████   ██ ██ ████   ██ ██      
          ██  █  ██ ███████ ██████  ██ ██  ██ ██ ██ ██  ██ ██   ███ 
          ██ ███ ██ ██   ██ ██   ██ ██  ██ ██ ██ ██  ██ ██ ██    ██ 
           ███ ███  ██   ██ ██   ██ ██   ████ ██ ██   ████  ██████  

******************************************************************************
  You are using PostgreSQL 12.16 for the ci database, but this version of GitLab requires PostgreSQL >= 13.

  If using gitlab-development-kit, please find the relevant steps here:
    https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/postgresql.md#upgrade-postgresql

  Please upgrade your environment to a supported PostgreSQL version. See
  https://docs.gitlab.com/ee/install/requirements.html#database for details.
******************************************************************************

Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Test environment set up in 0.977996885 seconds
.......................................

Finished in 26.33 seconds (files took 13 seconds to load)
39 examples, 0 failures

Randomized with seed 46220

[TEST PROF INFO] Time spent in factories: 00:09.200 (33.31% of total time)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by mo khan

Merge request reports