-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a way to run multiple test suites #67
Conversation
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
Would it be possible to add |
Found some spare time to work on this. Waiting for tests to pass locally. |
@TomasTomecek if you specified [test] |
b95ff2b
to
a7a1d72
Compare
Is it my fault? (rebased and updated the commit message) |
That was a red herring. The actual error was this:
So should be fixed by the rebase. [test] |
The ruby PR needs to be rebased as well @TomasTomecek |
rebased |
Thanks! [test] |
Tests are failing now because conu tests are being run for all the image versions, but the ruby PR only provides @TomasTomecek Can you add the conu tests for other versions as well? |
I'm busy atm, I hope I'll take a look and fix this next week. |
Updated. [test] |
test.sh
Outdated
fi | ||
for test_script in ${TEST_SUITES}; do | ||
if [ "${TEST_MODE}" == "container" ]; then | ||
docker run --net=host -e VERSION=$dir -e IMAGE_NAME --rm -v /dev:/dev:ro -v /var/lib/docker:/var/lib/docker:ro --security-opt label=disable --cap-add SYS_ADMIN -ti -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/src -w /src docker.io/modularitycontainers/conu $test_script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind to split this into multiple lines, so it can be more human-readble?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
test.sh
Outdated
|
||
# FIXME: deprecate TEST_OPENSHIFT_MODE and use TEST_SUITES instead? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this seems like the way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do that in dedicated PR since I have no idea how much it has to be done in other repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should not be any changes needed in other repositories afaik.
common.mk
Outdated
@@ -64,7 +66,7 @@ $(VERSIONS): % : %/root/help.1 | |||
.PHONY: test check | |||
check: test | |||
|
|||
test: script_env += TEST_MODE=true | |||
test: script_env += TEST_MODE=local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The strange thing is, that this variable now has different meaning...
Previously it was used to switch the test suite on
, not to define test variant
(or environment). I'd say the variable chosen before was somehow unfortunate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do I invent a new one then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some meaning change behind the variable usage but I do not think it is necessary to introduce a different one just because of that. The variable should only be used in common scripts anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue I see with the way it is used now is that there is no way to set this variable to any other value.
test.sh
Outdated
-v /var/run/docker.sock:/var/run/docker.sock \ | ||
-v ${PWD}:/src \ | ||
-w /src \ | ||
docker.io/modularitycontainers/conu \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to find image 'docker.io/modularitycontainers/conu:latest' locally
Trying to pull repository docker.io/modularitycontainers/conu ...
/usr/bin/docker-current: manifest for docker.io/modularitycontainers/conu:latest not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using docker.io/modularitycontainers/conu:0.2.0
instead works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image does not seem to have pytest-3
though ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We moved conu to our github org and I can't figure out how to configure automated build there. Seems github changed how apps/services work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docker image is still not working:
$ docker pull docker.io/modularitycontainers/conu:latest
Trying to pull repository docker.io/modularitycontainers/conu ...
Pulling repository docker.io/modularitycontainers/conu
Tag latest not found in repository docker.io/modularitycontainers/conu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lastest image I've found is dev
, which is 5 months old:
https://hub.docker.com/r/modularitycontainers/conu/tags/
Unfortunately, I don't have time to finish this one. What would I need to do to land this one? |
I think it just needs to pass the tests- the code looks good. |
7e2ddb3
to
7d05015
Compare
Finally found some spare time to finish this. Please see my changes. |
test.sh
Outdated
-v ${PWD}/../:/src \ | ||
-w /src/${dir}/ \ | ||
-ti \ | ||
docker.io/usercont/conu:0.6.2 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to have some floating docker tag here instead of 0.6.2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually not: in case we accidentally create a breaking change in a new version, we don't want all your conu tests to start failing. I think it's a better approach to systematically update to newer versions once you're sure they work as you expect. Using latest greatest might be pretty adventurous, especially when the container ecosystem is still changing rapidly.
But your call, really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using latest greatest might be pretty adventurous
By floating tag I did not mean "latest greatest", but rather "latest stable". Whether we'll update the version here all the time by PR, or you'll tag it into "conu:stable" tag doesn't make much practical difference - API changes will hurt us and PR is only additional work. Btw., conu should simplify our lives so we don't have to take care of ever-changing container API, not that we'll have to take care ever-changing API in conu.
test.sh
Outdated
--security-opt label=disable \ | ||
--cap-add SYS_ADMIN \ | ||
-ti \ | ||
-v /var/run/docker.sock:/var/run/docker.sock \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmpfs, this means we give a lot of trust into that container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference in running the tests directly on host?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope we didn't run privileged container, nor UID=0 container in testsuite so far in our suite -- except for build -- but I don't know, I thought docker build
isn't mounting insecure things into the container. That said, I thought it is banned policy to give a random container write access to a docker socket. But I'm probably too old school; /me just dropped the UID from docker group, and I'll run the suite in VM.
The code basically LGTM if that was optional. But ideally, we should give the end-user chance to install conu library on the host. If installing conu isn't possible, user could opt-in running privileged container (e.g. by |
The library is packaged in Fedora so it's not a problem installing it. One thing to note is that we are planning to remove python2 support (no one ever used it actually): I'm not sure if you are planning to use it on CentOS 7 hosts.
Please advise me the precise steps, maybe something like this?
Btw +1 on being able to pick the conu version with the env var. |
Yes, but there is Python 3 from RHSCL, so it shouldn't be a problem.
I'd much rather see something like: if $THERE_ARE_NO_CONU_TESTS; then
exit 0
fi
if test -n "$CONU_IMAGE"; then
docker run --rm -ti .. "$CONU_IMAGE" ..
else
./test/run-conu
fi In other words, I don't think it is problem to see |
There are other prerequisites, so this shouldn't be a problem as long as rpm is easily installable in Fedora/RHEL/CentOS! Python3 RHSCL is fine, but it's harder to use it as rpm dependency. Using conu in container might have some problems, but user gets running tests out of the box. How to install conu in RHEL7/Centos7? |
7d05015
to
f760d23
Compare
It's packaged in epel7. I can see we haven't updated it in a while: https://src.fedoraproject.org/rpms/conu/blob/epel7/f/conu.spec I don't think it's such a big deal to keep packaging it for epel. On the other hand, I just realized that python-kubernetes is not available in epel:
Yes, that's a fair point: the container has more permissions than your unpriv user. I updated the code with your suggestions. The ruby test suite keeps passing:
|
Thanks! |
Required-by: s2i-ruby-container#167 Signed-off-by: Tomas Tomecek <[email protected]>
f760d23
to
1244033
Compare
I just realized that the container had too many privileges for no reason, I stripped that down. PTAL |
[test] let's test the Required-by |
Pushed as f1539e9 (fixed $PWD escape). |
Thank you! I'll have a beer to celebrate this. |
Related: sclorg/s2i-ruby-container#167
Initial version. I'm open to change the workflow & names. Please, advise.
TODO:
TEST_SUITES := "test1 test2"
and thenfor x in ${TEST_SUITES}; ...