-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a way to run integration tests inside openshift
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
- Loading branch information
1 parent
0aba881
commit 11ca8d5
Showing
10 changed files
with
111 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# For running tests locally, see check_in_container target in Makefile | ||
|
||
FROM docker.io/usercont/packit | ||
FROM docker.io/usercont/packit-service-worker | ||
|
||
COPY files/install-deps.yaml ./ | ||
RUN ansible-playbook -vv -c local -i localhost, ./install-deps.yaml | ||
RUN set -ex; mkdir -p /home/packit/.config \ | ||
&& ln -s $PS_PATH/files/packit-service.yaml /home/packit/.config/packit-service.yaml \ | ||
&& ansible-playbook -vv -c local -i localhost, ./files/recipe-tests.yaml | ||
|
||
COPY files/recipe-tests.yaml ./ | ||
RUN ansible-playbook -vv -c local -i localhost, ./recipe-tests.yaml | ||
|
||
WORKDIR /src | ||
# we are doing the same here as in worker Df so that we don't need to rerun the | ||
# playbook above for every code change: iterating fast <3 | ||
COPY . $PS_PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/bash | ||
|
||
set -x | ||
|
||
source /src-packit-service/files/setup_env_in_openshift.sh | ||
|
||
id | ||
|
||
cat $HOME/.config/packit-service.yaml | ||
|
||
pytest-3 -vv tests/openshift_integration/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/bash | ||
|
||
set -x | ||
|
||
export PACKIT_HOME=/home/packit | ||
# Generate passwd file based on current uid, needed for fedpkg | ||
grep -v ^packit /etc/passwd > ${PACKIT_HOME}/passwd | ||
printf "packit:x:$(id -u):0:Packit Service:/home/packit:/bin/bash\n" >> ${PACKIT_HOME}/passwd | ||
export LD_PRELOAD=libnss_wrapper.so | ||
export NSS_WRAPPER_PASSWD=${HOME}/passwd | ||
export NSS_WRAPPER_GROUP=/etc/group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: packit-tests | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: packit-tests | ||
image: packit-service-tests | ||
imagePullPolicy: Never # IfNotPresent | ||
workingDir: /src-packit-service | ||
# volumeMounts: | ||
# - name: packit-ssh | ||
# mountPath: /packit-ssh | ||
# - name: packit-secrets | ||
# mountPath: /secrets | ||
# - name: packit-config | ||
# mountPath: /home/packit/.config | ||
# - name: packit-worker-vol | ||
# mountPath: /sandcastle | ||
command: ["bash", "/src-packit-service/files/run_tests.sh"] | ||
backoffLimit: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
--- | ||
- name: This is a recipe for how to run packit tests | ||
- name: Run packit-service tests | ||
hosts: all | ||
tasks: | ||
- include_tasks: tasks/zuul-project-setup.yaml | ||
- name: Build packit-service worker image from current src dir | ||
- name: Run tests within a container | ||
command: "make check_in_container" | ||
args: | ||
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" | ||
become: true | ||
- name: Run tests which are executed within openshift | ||
command: make check-inside-openshift | ||
args: | ||
chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" | ||
become: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
# | ||
# Copyright (c) 2018-2019 Red Hat, Inc. | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. |