Skip to content
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

tests: add run-openshift template tests #209

Merged
merged 6 commits into from
Dec 1, 2017

Conversation

pkubatrh
Copy link
Member

Resolves: #204

@pkubatrh
Copy link
Member Author

@omron93 Are the tests run when they are present or do we have to trigger them manually in some way?

set -exo nounset

function check_postgresql_os_service_connection() {
local util_image_name="${1}" ; shift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:please use just "foo=$baz" syntax. Looks much nicer, the quotes and brackets are not needed in this case.


THISDIR=$(dirname ${BASH_SOURCE[0]})

source ${THISDIR}/test-lib-openshift.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather quote $THISDIR.

: " Service ${service_name} check ..."

local cmd="echo 'SELECT 42 as testval' | PGPASSWORD=${pass} PGCONNECT_TIMEOUT=15 \
psql -t -h ${pod_ip} -U ${user} -d ${database}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use pg_isready, since that will be the live check in future, too?

}

function test_postgresql_pure_image() {
local image_name=${1:-centos/postgresql-96-centos7}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value seems to be unused, so image_name=$1 would look a bit safer.

ct_os_wait_pod_ready "${service_name}" 60
check_postgresql_os_service_connection "${image_name}" "${service_name}" testu testp testdb

ct_os_delete_project
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this seems to be promising! I'm looking forward to see the library code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's already there :-) my bad.

@praiskup
Copy link
Contributor

Seems like the 'test-openshift' target used to be in https://github.com/sclorg/rhscl-container-ci/blob/master/yaml/jobs/collections/mongodb-rh.yaml so the openshift tests used to be triggered automatically for mongo. Better approach could be to invoke the tests-openshift target for every image, and that target could succeed with "not-implemented" message if the image is not yet CI-tested for openshift.

@pkubatrh
Copy link
Member Author

@praiskup Made some changes according to your suggestions, thanks!

@pkubatrh
Copy link
Member Author

Seems like the code works on both rhel and centos-based Openshift installations. Only the library does not yet provide any functions to install openshift on a rhel7 system.

@pkubatrh
Copy link
Member Author

@omron93 Since make test-openshift should be a no-op if the openshift tests are not present can we enable the make target to be triggered by default on every image in CI?

@omron93
Copy link
Contributor

omron93 commented Nov 28, 2017

@omron93 Since make test-openshift should be a no-op if the openshift tests are not present can we enable the make target to be triggered by default on every image in CI?

OK. I've enabled it for all images. Test has to be explicitly triggered by [test-openshift]

Seems like the code works on both rhel and centos-based Openshift installations. Only the library does not yet provide any functions to install openshift on a rhel7 system.

I would let installing oc tool to the user (and to the CI), same we do with docker-squash. It simplify our tests and avoid problems with different environments.

@omron93
Copy link
Contributor

omron93 commented Nov 28, 2017

RHEL CI is failing because you try to install centos package (CI image already contain oc).
In CentOS there is problem with starting cluster. I'll investigate it tomorrow.

@pkubatrh
Copy link
Member Author

RHEL CI is failing because you try to install centos package (CI image already contain oc).

Looking at the logs the centos image does not seem to have openshift installed by default. Are we going to update it so it does or should I just make the install function call specific to centos?

@pkubatrh
Copy link
Member Author

In CentOS there is problem with starting cluster. I'll investigate it tomorrow.

The same issue is in rhel, it happens only the first time the cluster up action is called. No idea how to work around it other than just not failing the first time and trying again...

@omron93
Copy link
Contributor

omron93 commented Nov 29, 2017

The same issue is in rhel, it happens only the first time the cluster up action is called. No idea how to work around it other than just not failing the first time and trying again...

iptables has to be flushed. Please take a look at sclorg/container-common-scripts#40

With this it should work. No ct_os_install_in_centos is needed (I would let this to user to setup testing machine - number of OS version,... is too big). So only ct_os_cluster_up is enought to start OpenShift in CI.

@pkubatrh
Copy link
Member Author

[test-openshift]

@pkubatrh
Copy link
Member Author

Seems like the openshift test fails now on docker login

@pkubatrh
Copy link
Member Author

[test-openshift]

@omron93
Copy link
Contributor

omron93 commented Nov 29, 2017

Seems like the openshift test fails now on docker login

It seems that it takes some time. In last centos openshift tests it succeeded in fifth attempt.

I'll try to find out what is causing this.

@pkubatrh
Copy link
Member Author

pkubatrh commented Dec 1, 2017

[test-openshift]

1 similar comment
@pkubatrh
Copy link
Member Author

pkubatrh commented Dec 1, 2017

[test-openshift]

@pkubatrh
Copy link
Member Author

pkubatrh commented Dec 1, 2017

@praiskup @omron93 For some reason I do not see rhel7 CI starting.

@omron93
Copy link
Contributor

omron93 commented Dec 1, 2017

For some reason I do not see rhel7 CI starting.

There was Jenkins upgrade by Central CI admins. But problems with plugins occurred so we have to wait. There will be probably next try in near future.

@pkubatrh
Copy link
Member Author

pkubatrh commented Dec 1, 2017

All checks passing now

@praiskup
Copy link
Contributor

praiskup commented Dec 1, 2017

Looks fine.

@pkubatrh
Copy link
Member Author

pkubatrh commented Dec 1, 2017

Thanks for review! Merging

@pkubatrh pkubatrh merged commit 036810a into sclorg:master Dec 1, 2017
@pkubatrh pkubatrh deleted the template_test branch December 1, 2017 14:41
}

function test_postgresql_template() {
local image_name=${1:-centos/postgresql-96-centos7}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there 'backup' image_name?
IMHO this should be tested specifically with the CI-built image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants