upload/koji: add a simple test

This commit adds a test which uploads a random file to Koji and runs CGImport.
The result is checked using the koji cli client.
This commit is contained in:
Ondřej Budai 2020-05-15 15:09:22 +02:00 committed by Tom Gundersen
parent a1c578c8d1
commit 4ebf6ee85b
5 changed files with 316 additions and 0 deletions

68
.github/koji.conf vendored Normal file
View file

@ -0,0 +1,68 @@
; Koji installed from pip is missing the default config.
; This one is taken from Fedora 32 and installed in Github Actions.
[koji]
;configuration for koji cli tool
;url of XMLRPC server
;server = http://hub.example.com/kojihub
server = https://koji.fedoraproject.org/kojihub
;url of web interface
;weburl = http://www.example.com/koji
weburl = https://koji.fedoraproject.org/koji
;url of package download site
;pkgurl = http://www.example.com/packages
;path to the koji top directory
;topdir = /mnt/koji
topurl = https://kojipkgs.fedoraproject.org/
;configuration for Kerberos authentication
authtype = kerberos
krb_rdns = false
;the service name of the principal being used by the hub
;krbservice = host
;the principal to auth as for automated clients
;principal = client@EXAMPLE.COM
;the keytab to auth as for automated clients
;keytab = /etc/krb5.keytab
;enable to lookup dns canonical hostname for krb auth
;krb_canon_host = no
;The realm of server principal. Using client's realm if not set
;krb_server_realm = EXAMPLE.COM
;configuration for SSL authentication
;client certificate
;cert = ~/.koji/client.crt
;certificate of the CA that issued the HTTP server certificate
;serverca = ~/.koji/serverca.crt
;plugin paths, separated by ':' as the same as the shell's PATH
;koji_cli_plugins module and ~/.koji/plugins are always loaded in advance,
;and then be overridden by this option
;plugin_paths = ~/.koji/plugins
;[not_implemented_yet]
;enabled plugins for CLI, runroot and save_failed_tree are available
;plugins =
; runroot plugin is enabled by default in fedora
plugins = runroot
;timeout of XMLRPC requests by seconds, default: 60 * 60 * 12 = 43200
;timeout = 43200
;timeout of GSSAPI/SSL authentication by seconds, default: 60
;auth_timeout = 60
; use the fast upload feature of koji by default
use_fast_upload = yes

View file

@ -136,3 +136,54 @@ jobs:
- name: "🔎 Test RPM installation"
run: dnf -y install $(ls rpms/*.x86_64.rpm)
koji:
name: "麹 Koji test"
runs-on: ubuntu-latest
services:
postgres:
image: docker.io/library/postgres:12-alpine
env:
POSTGRES_USER: koji
POSTGRES_PASSWORD: kojipass
POSTGRES_DB: koji
koji:
image: quay.io/osbuild/ghci-koji:v1
env:
POSTGRES_USER: koji
POSTGRES_PASSWORD: kojipass
POSTGRES_DB: koji
POSTGRES_HOST: postgres
ports:
- 8080:80
steps:
- name: Set up Go 1.12
uses: actions/setup-go@v1
with:
go-version: 1.12
id: go
# We need python for koji client.
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# Koji from pip is missing its config file.
# To fix this, the default Fedora 32 config is included in the repo
# and installed here. See the last line of the script.
- name: Install koji client
run: |
sudo apt-get install -y libkrb5-dev
python -m pip install --upgrade pip
pip install koji
sudo cp .github/koji.conf /etc/koji.conf
- name: Run unit tests
run: go test -v -race -covermode atomic -coverprofile=coverage.txt -tags koji_test ./internal/upload/koji
- name: Send coverage to codecov.io
run: bash <(curl -s https://codecov.io/bash)