Commit graph

35 commits

Author SHA1 Message Date
Lukáš Zachar
a0ddcd21c4 Update system during systemtap probe test
Otherwise CI might be running old kernel which
no longer exists in repositories making the stap-prep fail on missing
debuginfo/devel packages.
2025-01-21 10:03:16 +01:00
Jun Aruga
9cbd536c42 Add a test for Ruby OpenSSL to respect crypto-policies TLS minimal version.
Add a test to test Ruby OpenSSL to respect cypto-policies TLS minimal version,
and test the issue identified at the ticket RHEL-21019.
https://issues.redhat.com/browse/RHEL-21019

If Ruby OpenSSL doesn't include the following upstream patch, the test fails as follows.
https://github.com/ruby/openssl/pull/710

```
$ tmt -c distro=fedora-rawhide run --all provision -h virtual -i fedora-rawhide tests -n '^/tls-minimal-version$'
/var/tmp/tmt/run-007
...
total: 1 test failed

$ tmt run --id run-007 report -vvv
...
                    :: [ 16:03:29 ] :: [  BEGIN   ] :: Running Ruby OpenSSL client :: actually running 'ruby /var/tmp/tmt/run-007/plans/all/discover/default-0/tests/tls-minimal-version/test.rb -v'
                    STDOUT: Loaded suite /var/tmp/tmt/run-007/plans/all/discover/default-0/tests/tls-minimal-version/test
                    STDOUT: Started
                    STDOUT: TestRubyOpenSSLTLSMin:
                    STDOUT:   test_connection_to_tls_1_2_server_to_fail:		F
                    STDOUT: ===============================================================================
                    STDOUT: Failure: test_connection_to_tls_1_2_server_to_fail(TestRubyOpenSSLTLSMin): <OpenSSL::SSL::SSLError> exception was expected but none was thrown.
                    STDOUT: /var/tmp/tmt/run-007/plans/all/discover/default-0/tests/tls-minimal-version/test.rb:13:in `test_connection_to_tls_1_2_server_to_fail'
                    STDOUT:      10:
                    STDOUT:      11: class TestRubyOpenSSLTLSMin < Test::Unit::TestCase
                    STDOUT:      12:   def test_connection_to_tls_1_2_server_to_fail
                    STDOUT:   => 13:     assert_raise_with_message(OpenSSL::SSL::SSLError,
                    STDOUT:      14:                               /tlsv1 alert protocol version/) do
                    STDOUT:      15:       connect(CONFIG_ITEMS[:tls_1_2][:host], CONFIG_ITEMS[:tls_1_2][:port])
                    STDOUT:      16:     end
                    STDOUT: ===============================================================================
                    STDOUT: : (0.075125)
                    STDOUT:   test_onnection_to_tls_1_3_server_to_pass:		.: (0.013862)
                    STDOUT:
                    STDOUT: Finished in 0.089378126 seconds.
                    STDOUT: -------------------------------------------------------------------------------
                    STDOUT: 2 tests, 2 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
                    STDOUT: 50% passed
                    STDOUT: -------------------------------------------------------------------------------
                    STDOUT: 22.38 tests/s, 22.38 assertions/s
                    :: [ 16:03:30 ] :: [   FAIL   ] :: Running Ruby OpenSSL client (Expected 0, got 1)
...
total: 1 test failed
```
2024-12-17 14:53:43 +01:00
Jun Aruga
6c9722646b README.md: Replace tmt test ls with tmt tests ls.
According to the output by `tmt --help`, the `tmt tests` is an official command
name.

```
$ tmt --version
tmt version: 1.38.0

$ tmt --help
...
Commands:
...
  tests    Manage tests (L1 metadata).
...
```
2024-11-20 17:27:07 +01:00
Jun Aruga
1ec0f08fb7 README.md: Remove a part of the available integration tests.
There is no "bundler-unit-test" in the repository.
The actual test was dropped at the following commit in the past. But the README
was not updated.

https://src.fedoraproject.org/tests/ruby/c/831c7db845139a463762c80470f85a963832204d?branch=main

The listed tests by `tmt test ls` is good enough to show the information.
2024-11-20 17:13:05 +01:00
Lukáš Zachar
25d149669e Require wget, iproute and procps-ng
These packages are used in the test itself, but weren't required.
When run on minimal installed system it could cause 'command not found'
problems
2024-11-14 10:37:43 +01:00
Lukáš Zachar
ec9c5bc5ed Use 'ss' to check whether port is free
This utility is used inside Beakerlib.
2024-11-14 10:28:46 +01:00
Vít Ondruch
f6f6efdfe9 Install Psych devel dependencies
This prevents `bundle install` failures like:

~~~
:: [ 00:30:49 ] :: [  BEGIN   ] :: Creating new rails application :: actually running 'rails new app | tee bundle.log'
      create
      create  README.md

... snip ...

Fetching rails 7.0.8.6
Installing rails 7.0.8.6
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/share/gems/gems/psych-5.2.0/ext/psych
/usr/bin/ruby -I/usr/share/rubygems extconf.rb
checking for pkg-config for yaml-0.1... not found
checking for yaml.h... no
yaml.h not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include=${opt-dir}/include
	--without-opt-include
	--with-opt-lib=${opt-dir}/lib64
	--without-opt-lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/$(RUBY_BASE_NAME)
	--with-libyaml-source-dir
	--without-libyaml-source-dir
	--with-yaml-0.1-dir
	--without-yaml-0.1-dir
	--with-yaml-0.1-include=${yaml-0.1-dir}/include
	--without-yaml-0.1-include
	--with-yaml-0.1-lib=${yaml-0.1-dir}/lib64
	--without-yaml-0.1-lib
	--with-yaml-0.1-config
	--without-yaml-0.1-config
	--with-pkg-config
	--without-pkg-config
	--with-libyaml-dir
	--without-libyaml-dir
	--with-libyaml-include=${libyaml-dir}/include
	--without-libyaml-include
	--with-libyaml-lib=${libyaml-dir}/lib64
	--without-libyaml-lib

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

  /usr/local/lib64/gems/ruby/psych-5.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/psych-5.2.0 for
inspection.
Results logged to /usr/local/lib64/gems/ruby/psych-5.2.0/gem_make.out

  /usr/share/rubygems/rubygems/ext/builder.rb:125:in `run'
  /usr/share/rubygems/rubygems/ext/ext_conf_builder.rb:28:in `build'
  /usr/share/rubygems/rubygems/ext/builder.rb:193:in `build_extension'
  /usr/share/rubygems/rubygems/ext/builder.rb:227:in `block in build_extensions'
  /usr/share/rubygems/rubygems/ext/builder.rb:224:in `each'
  /usr/share/rubygems/rubygems/ext/builder.rb:224:in `build_extensions'
  /usr/share/rubygems/rubygems/installer.rb:844:in `build_extensions'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/rubygems_gem_installer.rb:109:in
`build_extensions'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/source/rubygems.rb:205:in
`install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/gem_installer.rb:55:in
`install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/gem_installer.rb:17:in
`install_from_spec'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/parallel_installer.rb:133:in
`do_install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/parallel_installer.rb:124:in
`block in worker_pool'
  /usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:62:in `apply_func'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:57:in `block in
process_queue'
  <internal:kernel>:187:in `loop'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:54:in
`process_queue'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:90:in `block (2
levels) in create_threads'

An error occurred while installing psych (5.2.0), and Bundler cannot continue.

In Gemfile:
  debug was resolved to 1.9.2, which depends on
    irb was resolved to 1.14.1, which depends on
      rdoc was resolved to 6.7.0, which depends on
        psych
         run  bundle binstubs bundler
Resolving dependencies...
       rails  importmap:install

... snip ...
~~~

Please note that this error happens only when Fedora ships older version
of Psych then the version available on RubyGems, so the libyaml-devel
might not be always needed.

There are also other possibilities to workaround the issue, such as:

* Excluding `development` and `test` groups from installation to avoid
  the `debug` gem dependency chain.
* Using `--skip-bundle` option and modifying the Gemfile generated
  for the Ruby on Rails app.

However, I believe that this is the most probable action our users would
take.

Also note that while there are installed other binary gems, such as
Nokogiri, those ships prebuild binaries. If Psych decides to do the same
in the future, the `libyaml-devel` might become redundant.
2024-11-13 13:48:20 +01:00
Lukáš Zachar
ec8759b052 Add a plan to run all the tests.
* Update the plan /plans/modified to run in CI. See the following link for the
  condition `trigger == commit`.
  https://tmt.readthedocs.io/en/stable/spec/context.html#trigger
* Add the plan /plans/all to run all the tests. The plan is not executed in CI
  as a default. Don't trigger this plan in CI to save the infra resource and
  the running time.
  Note we don't describe the triggered environment such as local or CI in the
  `summary` element in the plan /plans/all of the `plans.fmf`. Because this
  plan is executed as a default, and users can override the triggered
  environment by running the `tmt` with `trigger` option, such as
  `tmt -c trigger=commit`. We don't want to give users the impression that the
  plan only works in a specific running environment.
* Update the `README.md` removing the parts of the `plans --default` option in
  the `tmt run` commands that are not needed due to the plan /plans/all.

Co-authored-by: Lukáš Zachar <lzachar@redhat.com>
2024-10-08 14:48:43 +02:00
Jarek Prokop
6eec1a682c Require rubygem-rails RPM only on Fedora.
CentOS Stream & RHEL >= 8 do not contain rubygem-rails.
Trying to install such RPM will fail.

It did not fail in CI for CentOS PR https://gitlab.com/redhat/centos-stream/rpms/ruby/-/merge_requests/44
due to the CI enabling Fedora repo, which is not correct.
This is tracked in https://issues.redhat.com/browse/TFT-2564

Furthermore, we also should not expect EPEL in the future:
https://issues.redhat.com/browse/TFT-2881
2024-10-02 20:05:42 +02:00
Jun Aruga
fa42fa7ad2 Update README adding how to run a specific test. 2024-10-01 18:10:24 +02:00
Jun Aruga
b90aa97120 Update README adding Contributing section.
* Add Contributing section including Testing sub section.
* Change the repository name's heading level.
  Replace the heading level 2 syntax ("--") with the more popular heading level
  1 syntax.
  See <https://www.markdownguide.org/basic-syntax/> for details.
2024-09-25 16:17:02 +02:00
Lukáš Zachar
17a421cf99 Disable native.../ruby31 on rhel-10 2024-08-06 18:21:43 +02:00
Lukáš Zachar
bbbeff3374 Improve checking for systemtap files
Log whether _STAP_FILE (the systemtap example) is used from any rpm.
Make sure the tapset (probes files) is used from PACKAGES
2024-08-05 11:50:47 +02:00
Lukáš Zachar
96ff9a3911 Set environment variables properly on non-fedora
Remove unused COLLECTION handling (collections are past end-of-life)
Remove PRINT variable
2024-08-05 11:50:01 +02:00
Lukáš Zachar
2dbe9872f1 Disable native-extension-gem../ruby31 on Fedora 2024-07-26 16:28:06 +02:00
Lukáš Zachar
d640ff95a5 Use _STAP_FILE value directly
Hardoced to the path in ruby-doc but can be changed from envar
2024-07-18 13:46:08 +02:00
Vít Ondruch
b658b742c0 Require rubypick only on Fedora
There is no rubypick in rhel/centos but is in Fedora:

7724c2d703/f/ruby.spec (_146-148)

This is the same fix as:

https://src.fedoraproject.org/fork/lzachar/tests/ruby/c/98bf2ce800d42d3b17df5af62b782c43d39f21f3
2024-07-18 09:54:17 +02:00
Lukáš Zachar
3dee01db19 squash: Use TracePoint
Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=2252100
and https://bugs.ruby-lang.org/issues/14582
2024-07-16 18:38:51 +02:00
Lukas Zachar
b35f6f20d7 systemtap-probe: sync downstream changes, fix require
While require on file in rpm works now, with dnf-5 it might not work out
of the box. Let's keep adding package which contains this file in the
require/recommend instead

Extend stap buffer size and limit "noise" produced by ruby interpreter
so stap output is more usable.
2024-07-16 18:38:51 +02:00
Lukas Zachar
082d2ec5c5 Remove Makefile/PURPOSE file, add summary/description 2024-07-16 18:38:49 +02:00
Lukáš Zachar
98bf2ce800 Require rubypick only on Fedora
There is no rubypick in rhel/centos but is in Fedora,
 7724c2d703/f/ruby.spec (_146-148)
2024-07-09 15:56:27 +02:00
Iveta Wiedermann
dc28d106a9 Delete installed files irrespective of rubygems version
Lower version of rubygems doesn't have 'user_gemhome' env variable
therefore there's a condition using different approach.
2023-03-28 17:50:10 +02:00
Iveta Wiedermann
873318151c native-extension: updating main.fmf
native-extension: moving all files to fedora and creating structure

native-extension: removing duplicated id
2023-03-16 11:18:23 +01:00
Iveta Wiedermann
9ab7b3ef3a native-extension: test installs gem under non-root user and cleans up better
native-extension: easier obtaining of user installation path

Change USER to TEST_USER

Don't use tmp file
2023-02-14 11:57:09 +01:00
Iveta Wiedermann
a83361d922 Adding new test for making sure native extension gem is installed without error. 2022-12-04 19:04:53 +01:00
Lukas Zachar
9c0b998188 Update run-basic-rails-application test
Remove ror-50 part (not supported anywhere any more)
Dropped rubyracer install
2022-11-30 13:52:53 +01:00
Lukas Zachar
2af06baec0 Add tmt plan to run modified tests
Will help with future PRs
2022-11-30 11:11:32 +01:00
Miroslav Vadkerti
831c7db845 Remove bundler unit tests
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-05-29 14:14:45 +02:00
Miroslav Vadkerti
2e9ba6a554 Add fixes for Fedora, improve waiting for stap
This patch fixes the execution of the test for Fedora. It also
includes improved waiting for stap, which uses now active waiting
instead of static sleep.

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-02-19 14:11:33 +01:00
Miroslav Vadkerti
057642bf1e Fix dependencies, run bundle install only when needed
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-02-19 13:08:10 +01:00
Miroslav Vadkerti
1511ce41c4 run-basic-rails-application: fix tests for Fedora
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-02-19 12:21:36 +01:00
Miroslav Vadkerti
d51d7fc445 bundler-unit-tests: add fixes for Fedora
This patch adds various fixes to the test case, so it can be executed on
Fedora.

Also fixes obvious issues with quoting in if statements.

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-02-19 12:16:39 +01:00
Miroslav Vadkerti
06c18fa5a3 README.md: rename from README
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-02-15 13:49:51 +01:00
Miroslav Vadkerti
4acde02b0b Add README file
Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-02-15 13:48:41 +01:00
Miroslav Vadkerti
a4cdc02f01 Import 3 integration tests
systemtap-static-probes-in-ruby: for testing ruby's systemtap api
bundler-unit-tests: to run bundler's unit tests
run-basic-rails-application: a simple rails application test

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
2018-02-15 13:42:17 +01:00