From 9a31ae2751b1c3aa2f4a8879ff54246fbe3b371d Mon Sep 17 00:00:00 2001 From: Dominik Gedon Date: Fri, 2 Aug 2024 11:27:51 +0200 Subject: [PATCH] QE: Update Ruby to version 3.3 Fixes https://github.com/SUSE/spacewalk/issues/17431 Signed-off-by: Dominik Gedon --- .github/workflows/rubocop.yml | 12 +- testsuite/.rubocop.yml | 2 +- testsuite/.rubocop_todo.yml | 233 +++++++++++++++++- testsuite/Gemfile | 2 +- .../dockerfiles/controller-dev/Dockerfile | 8 +- .../05_install_gems_in_controller.sh | 2 +- 6 files changed, 235 insertions(+), 24 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 19daa23d6cf5..c850f098ce6e 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -17,19 +17,11 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: '2.5' + ruby-version: '3.3' - name: Install Rubocop run: | - gem install parallel -v 1.10 - gem install parser -v 3.0.0.0 - gem install rainbow -v 2.2.2 - gem install regexp_parser -v 1.8 - gem install rexml - gem install rubocop-ast -v 1.7.0 - gem install ruby-progressbar -v 1.7 - gem install unicode-display_width -v 1.4.0 - gem install rubocop -v 1.17.0 + gem install rubocop -v 1.65.1 - name: Run RuboCop run: | diff --git a/testsuite/.rubocop.yml b/testsuite/.rubocop.yml index d0eac6904335..255d7165f698 100644 --- a/testsuite/.rubocop.yml +++ b/testsuite/.rubocop.yml @@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml AllCops: EnabledByDefault: true SuggestExtensions: false - TargetRubyVersion: 2.5 + TargetRubyVersion: 3.3 Style/MissingElse: Enabled: false diff --git a/testsuite/.rubocop_todo.yml b/testsuite/.rubocop_todo.yml index 169f711877cd..67dc40414bd7 100644 --- a/testsuite/.rubocop_todo.yml +++ b/testsuite/.rubocop_todo.yml @@ -1,25 +1,158 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-11-17 13:57:32 UTC using RuboCop version 1.17.0. +# on 2024-08-19 12:51:03 UTC using RuboCop version 1.65.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 31 -# Configuration parameters: RequireForNonPublicMethods. +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'Rakefile' + +# Offense count: 26 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: leading, trailing +Layout/LineContinuationLeadingSpace: + Exclude: + - 'features/step_definitions/command_steps.rb' + - 'features/step_definitions/vm_steps.rb' + - 'features/support/kubernetes.rb' + +# Offense count: 19 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/LineContinuationSpacing: + Exclude: + - 'features/support/kubernetes.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Exclude: + - 'features/step_definitions/command_steps.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAfterComma: + Exclude: + - 'Rakefile' + +# Offense count: 1 +# Configuration parameters: DebuggerMethods, DebuggerRequires. +Lint/Debugger: + Exclude: + - 'features/step_definitions/common_steps.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/RedundantRequireStatement: + Exclude: + - 'features/step_definitions/command_steps.rb' + - 'features/support/cobbler_test.rb' + - 'features/support/env.rb' + +# Offense count: 1 +# Configuration parameters: LengthThreshold. +Metrics/CollectionLiteralLength: + Exclude: + - 'features/support/constants.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, BlockForwardingName. +# SupportedStyles: anonymous, explicit +Naming/BlockForwarding: + Exclude: + - 'features/support/commonlib.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, conditionals +Style/AndOr: + Exclude: + - 'Rakefile' + +# Offense count: 10 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. +# RedundantRestArgumentNames: args, arguments +# RedundantKeywordRestArgumentNames: kwargs, options, opts +# RedundantBlockArgumentNames: blk, block, proc +Style/ArgumentsForwarding: + Exclude: + - 'features/support/commonlib.rb' + +# Offense count: 48 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/ArrayFirstLast: + Exclude: + - 'ext-tools/collect_and_tag_flaky_tests.rb' + - 'ext-tools/maintenance_crawler.rb' + - 'features/step_definitions/api_common.rb' + - 'features/step_definitions/command_steps.rb' + - 'features/step_definitions/common_steps.rb' + - 'features/step_definitions/docker_steps.rb' + - 'features/step_definitions/salt_steps.rb' + - 'features/step_definitions/setup_steps.rb' + - 'features/step_definitions/smdba_steps.rb' + - 'features/step_definitions/vm_steps.rb' + - 'features/support/commonlib.rb' + - 'features/support/http_client.rb' + - 'features/support/namespaces/api.rb' + - 'features/support/twopence_init.rb' + +# Offense count: 2 +# Configuration parameters: AllowedMethods, RequireForNonPublicMethods. Style/DocumentationMethod: Exclude: - 'spec/**/*' - 'test/**/*' - 'features/support/commonlib.rb' + - 'features/support/twopence_init.rb' + +# Offense count: 5 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedReceivers. +# AllowedReceivers: Thread.current +Style/HashEachMethods: + Exclude: + - 'Rakefile' + - 'features/step_definitions/command_steps.rb' + - 'features/step_definitions/setup_steps.rb' + +# Offense count: 91 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either, consistent, either_consistent +Style/HashSyntax: + Exclude: + - 'ext-tools/collect_and_tag_flaky_tests.rb' + - 'features/step_definitions/command_steps.rb' + - 'features/step_definitions/docker_steps.rb' + - 'features/step_definitions/navigation_steps.rb' + - 'features/step_definitions/setup_steps.rb' + - 'features/support/commonlib.rb' + - 'features/support/lavanda.rb' + - 'features/support/namespaces/actionchain.rb' + - 'features/support/namespaces/activationkey.rb' - 'features/support/namespaces/channel.rb' + - 'features/support/namespaces/configchannel.rb' - 'features/support/namespaces/image.rb' + - 'features/support/namespaces/kickstart.rb' - 'features/support/namespaces/system.rb' - - 'features/support/twopence_init.rb' + - 'features/support/namespaces/user.rb' -# Offense count: 16 -# Cop supports --auto-correct. +# Offense count: 20 +# This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Exclude: - 'features/step_definitions/cobbler_steps.rb' @@ -32,9 +165,17 @@ Style/IfUnlessModifier: - 'features/step_definitions/vm_steps.rb' - 'features/support/http_client.rb' -Style/InlineComment: +# Offense count: 76 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: InverseMethods. +Style/InvertibleUnlessCondition: + Enabled: false + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/MapIntoArray: Exclude: - - 'features/support/constants.rb' + - 'features/support/cobbler_test.rb' # Offense count: 7 # Configuration parameters: AllowedMethods. @@ -46,9 +187,85 @@ Style/OptionalBooleanParameter: - 'features/support/http_client.rb' - 'features/support/lavanda.rb' +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/RedundantFilterChain: + Exclude: + - 'features/step_definitions/api_common.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantParentheses: + Exclude: + - 'features/step_definitions/retail_steps.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantRegexpArgument: + Exclude: + - 'features/step_definitions/command_steps.rb' + - 'features/step_definitions/salt_steps.rb' + - 'features/support/lavanda.rb' + +# Offense count: 25 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantStringEscape: + Exclude: + - 'features/step_definitions/cobbler_steps.rb' + - 'features/step_definitions/command_steps.rb' + - 'features/step_definitions/file_management_steps.rb' + - 'features/step_definitions/smdba_steps.rb' + - 'features/step_definitions/vm_steps.rb' + +# Offense count: 35 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/RequireOrder: + Exclude: + - 'Rakefile' + - 'ext-tools/collect_and_tag_flaky_tests.rb' + - 'ext-tools/maintenance_crawler.rb' + - 'features/step_definitions/command_steps.rb' + - 'features/step_definitions/common_steps.rb' + - 'features/step_definitions/docker_steps.rb' + - 'features/step_definitions/salt_steps.rb' + - 'features/step_definitions/security_steps.rb' + - 'features/support/api_test.rb' + - 'features/support/cobbler_test.rb' + - 'features/support/code_coverage.rb' + - 'features/support/commonlib.rb' + - 'features/support/env.rb' + - 'features/support/lavanda.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SelectByRegexp: + Exclude: + - 'features/step_definitions/api_common.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/SuperArguments: + Exclude: + - 'features/support/custom_formatter.rb' + # Offense count: 1 # Configuration parameters: EnforcedStyle. # SupportedStyles: forbid_mixed_logical_operators, forbid_logical_operators Style/UnlessLogicalOperators: Exclude: - 'features/step_definitions/vm_steps.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/YAMLFileRead: + Exclude: + - 'Rakefile' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: . +# SupportedOperators: *, +, &, |, ^ +Style/YodaExpression: + Exclude: + - 'features/support/commonlib.rb' + - 'features/support/env.rb' diff --git a/testsuite/Gemfile b/testsuite/Gemfile index 3c688b06abc3..b9e12b938fe7 100644 --- a/testsuite/Gemfile +++ b/testsuite/Gemfile @@ -24,7 +24,7 @@ gem 'rake', '~> 13.2' gem 'redis', '~> 5.2' gem 'redis-client', '~> 0.22' gem 'require_all', '~> 3.0' -# gem 'rubocop', '1.17.0' +gem 'rubocop', '1.65.1' gem 'selenium-webdriver', '4.23.0' gem 'simplecov', '~> 0.22' gem 'syntax', '~> 1.2' diff --git a/testsuite/dockerfiles/controller-dev/Dockerfile b/testsuite/dockerfiles/controller-dev/Dockerfile index c911df61c441..1d613b05a468 100644 --- a/testsuite/dockerfiles/controller-dev/Dockerfile +++ b/testsuite/dockerfiles/controller-dev/Dockerfile @@ -41,6 +41,7 @@ CMD ssh-keygen -A && /usr/sbin/sshd -De ### Ruby 3 changes ### RUN export GEM_PATH="/usr/lib64/ruby/gems/3.3.0" +RUN echo 'GEM_PATH="/usr/lib64/ruby/gems/3.3.0"' >> ./root/.bashrc RUN ln -sf /usr/bin/ruby.ruby3.3 /usr/bin/ruby RUN ln -sf /usr/bin/gem.ruby3.3 /usr/bin/gem @@ -62,7 +63,8 @@ RUN git clone https://github.com/nodeg/twopence.git /root/twopence && \ cd /root/twopence && \ git checkout update_ruby && \ make && \ - make install && \ - gem list - + make install +RUN gem list | grep twopence +RUN ln -s /usr/lib64/ruby/gems/3.3.0/gems/twopence-0.4.2/lib/twopence.so /usr/lib64/ruby/gems/3.3.0/gems/twopence-0.4.2/lib/twopence.so.0 +RUN ldconfig RUN curl https://raw.githubusercontent.com/nodeg/uyuni/master/testsuite/Gemfile -o Gemfile && bundle.ruby3.3 install && rm Gemfile diff --git a/testsuite/podman_runner/05_install_gems_in_controller.sh b/testsuite/podman_runner/05_install_gems_in_controller.sh index 38bd87c38439..53d019481f72 100755 --- a/testsuite/podman_runner/05_install_gems_in_controller.sh +++ b/testsuite/podman_runner/05_install_gems_in_controller.sh @@ -1,3 +1,3 @@ #!/bin/bash set -xe -sudo -i podman exec controller bash -c "cd /testsuite && bundle.ruby3.3 install --gemfile Gemfile" +sudo -i podman exec controller bash -c "cd /testsuite && bundle.ruby3.3 install --gemfile Gemfile --verbose"