COPY: https://pagure.io/modularity-testing-framework/issue/45
config.yaml
document: modularity-testing
version: 1
name: ruby
modulemd-url: http://raw.githubusercontent.com/container-images/ruby/master/ruby.yaml
packages:
rpms:
- ruby
testdependecies:
rpms:
- which
module:
docker:
start: "docker run -it -p 11211:11211"
labels:
description: "An interpreter of object-oriented scripting language"
io.k8s.description: "An interpreter of object-oriented scripting language"
source: https://github.com/sclorg/s2i-ruby-container.git
container: docker.io/junaruga/ruby
rpm:
repos:
- http://download.eng.brq.redhat.com/pub/fedora/linux/development/rawhide/Everything/x86_64/os/
test:
cmd:
- 'which ruby'
version:
- 'ruby -v'
testhost:
cmd_on_host:
- 'which ruby'
version_on_host:
- 'ruby -v'
/etc/yum.repos.d/ruby.repo
[ruby1]
name=ruby1
baseurl=http://download.eng.brq.redhat.com/pub/fedora/linux/development/rawhide/Everything/x86_64/os/
enabled=1
gpgcheck=0
Then ran
$ sudo MODULE=nspawn avocado run ./*.py
JOB ID : dfd967984b55055eb2d39129dc768c1dbb1f6939
JOB LOG : /root/avocado/job-results/job-2017-04-25T15.56-dfd9679/job.log
TESTS : 4
(1/4) ./generated.py:GeneratedTestsConfig.test_cmd: ERROR (145.90 s)
(2/4) ./generated.py:GeneratedTestsConfig.test_version: PASS (150.21 s)
(3/4) ./generated.py:GeneratedTestsConfig.test_cmd_on_host: PASS (158.89 s)
(4/4) ./generated.py:GeneratedTestsConfig.test_version_on_host: PASS (131.42 s)
RESULTS : PASS 3 | ERROR 1 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
TESTS TIME : 586.43 s
JOB HTML : /root/avocado/job-results/job-2017-04-25T15.56-dfd9679/html/results.html
And when I saw the job.log
, the process to install which
that is needed for 1st test, looks more late than the test is executed. Look at time in the log file.
...
2017-04-25 15:59:04,458 stacktrace L0038 ERROR|-
2017-04-25 15:59:04,458 stacktrace L0041 ERROR| Reproduced traceback from: /usr/lib/python2.7/site-packages/avocado/core/test.py:488
2017-04-25 15:59:04,463 stacktrace L0044 ERROR| Traceback (most recent call last):
2017-04-25 15:59:04,463 stacktrace L0044 ERROR| File "/home/jaruga/git/fedora-packages/modules/ruby/tests/generated.py", line 17, in test_cmd
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| self.run("which ruby")
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| File "/usr/lib/python2.7/site-packages/moduleframework/module_framework.py", line 548, in run
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| return self.backend.run(*args, **kwargs)
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| File "/usr/lib/python2.7/site-packages/moduleframework/module_framework.py", line 493, in run
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| comout.exit_status, **kwargs)
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| File "/usr/lib/python2.7/site-packages/moduleframework/module_framework.py", line 72, in runHost
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| return utils.process.run("%s" % command, **kwargs)
2017-04-25 15:59:04,464 stacktrace L0044 ERROR| File "/usr/lib/python2.7/site-packages/avocado/utils/process.py", line 1096, in run
2017-04-25 15:59:04,465 stacktrace L0044 ERROR| raise CmdError(cmd, sp.result)
2017-04-25 15:59:04,465 stacktrace L0044 ERROR| CmdError: Command 'bash -c "echo DO NOT CARE of this command, this is workaound for good exit status; exit 127"' failed (rc=127)
2017-04-25 15:59:04,465 stacktrace L0045 ERROR|-
...
2017-04-25 15:59:15,000 process L0368 INFO | Running 'dnf -y install which'
...
jscotka
3 months ago
Hi,
there is several issues.
why do you have start: "docker run -it -p 11211:11211" as command? In case this container does not provide any service it can be empty. (Probably you were testing just nspawn type, so you've did not met any docker issue)
I'm not sure about "which" things. from my POV "which" is not installed by default in modularity, so you have to install it in case you would like to use "which". But there is possible that I'm doing that wrong, that I don't install base profile from base-runtime, what could install some commands like that. But also in that case it is better to explicitly add there dependencies on "which" if you are using that.
you have tests also in section of yaml: "testhost:" what causes that these tests are done on host machine, not inside "module" so that it is testing system ruby. For you ruby module, every tests has to be in section "test:" (what is done inside module)
3 months ago
Metadata Update from @jscotka:
- Issue tagged with: Prio3
jaruga
3 months ago
@jscotka thanks for mentioning this.
=>
(Probably you were testing just nspawn type, so you've did not met any docker issue)
Yes, you are right.
I have not tried below docker mode command yet.
So, the module: docker: element is just a copy from http://pkgs.fedoraproject.org/cgit/modules/memcached.git/tree/tests/config.yaml . I forgot to remove the -p 11211:11211.
$ sudo MODULE=docker avocado run ./*.py
=>
Sure. As my understanding, below setting is enough to use dependency packages that are used in the config.yaml. So, I want to ask someone in this project about the specification.
testdependecies:
rpms:
- which
=>
Sure. the ruby tests in testhost element, are meaningless.
I will change the tests.
igulina
a month ago
@Jaruga , please let us know if this issue can be closed, or maybe we should update docs or anth else. Thank you.
jaruga
21 days ago
@igulina sorry it has not been fixed yet.
Can you try below ways on your environment?
$ git clone ssh://jaruga @pkgs.fedoraproject.org/modules/ruby
$ cd ruby
$ git diff
diff --git a/tests/config.yaml b/tests/config.yaml
index 14c3078. 82e8025 100644
--- a/tests/config.yaml
+++ b/tests/config.yaml
@@ -13,6 +13,9 @@ testdependecies:
rpms:
-
cmd:
-
- 'which ruby'
module:
docker:
container: docker.io/ruby
diff --git a/tests/ruby_tests.py b/tests/ruby_tests.py
index ce9bbd5. cc0362c 100644
--- a/tests/ruby_tests.py
+++ b/tests/ruby_tests.py
@@ -4,6 +4,7 @@ import socket
from avocado import main
from moduleframework import module_framework
class RubyTests(module_framework.AvocadoTest):
"""
๐ฅ enable
@@ -13,14 +14,6 @@ class RubyTests(module_framework.AvocadoTest):
self.start()
self.run("which ruby")
def test_version(self):
self.start()
self.run("ruby -v")
def test_hostname(self):
self.start()
self.run("hostname")
if name == 'main':
main()
$ sudo make test