osbuild-composer-koji.socket: use standard https port

Rather than using the arbitrary port 8701, use the standard 443. The
worker API will remain on a separate port, and as long as the two APIs
are exposed by the same binary that will have to remain separate at
8700.

Move the test instance of koji on localhost from 443 to 4343, to avoid a
conflict.

In a follow-up we should also give this API a prefix, so the cloud API
can share the same port with it.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-09-16 18:38:46 +01:00 committed by Ondřej Budai
parent 06c582a206
commit 4f39a33d34
6 changed files with 13 additions and 13 deletions

View file

@ -85,7 +85,7 @@ jobs:
- name: Run unit tests
run: |
sudo internal/upload/koji/run-koji-container.sh start
koji --server=http://localhost/kojihub --user kojiadmin --password kojipass --authtype=password make-task image
koji --server=http://localhost:8080/kojihub --user kojiadmin --password kojipass --authtype=password make-task image
env KRB5_CONFIG=../../../.github/krb5.conf go test -v -race -covermode atomic -coverprofile=coverage.txt -tags koji_test ./internal/upload/koji
sudo internal/upload/koji/run-koji-container.sh stop

View file

@ -3,7 +3,7 @@ Description=OSBuild Composer Koji API socket
[Socket]
Service=osbuild-composer.service
ListenStream=8701
ListenStream=443
[Install]
WantedBy=sockets.target

View file

@ -24,7 +24,7 @@ import (
func TestKojiRefund(t *testing.T) {
shareDir := "/tmp/osbuild-composer-koji-test"
server := "https://localhost/kojihub"
server := "https://localhost:4343/kojihub"
// base our transport on the default one
transport := http.DefaultTransport.(*http.Transport).Clone()
@ -77,7 +77,7 @@ func TestKojiRefund(t *testing.T) {
func TestKojiImport(t *testing.T) {
// define constants
server := "https://localhost/kojihub"
server := "https://localhost:4343/kojihub"
filename := "image.qcow2"
filesize := 1024
shareDir := "/tmp/osbuild-composer-koji-test"

View file

@ -80,8 +80,8 @@ koji_start() {
${CONTAINER_RUNTIME} run -d --name org.osbuild.koji.koji --network org.osbuild.koji \
-v "${SHARE_DIR}:/share:z" \
-p 80:80 \
-p 443:443 \
-p 8080:80 \
-p 4343:443 \
-e POSTGRES_USER=koji \
-e POSTGRES_PASSWORD=kojipass \
-e POSTGRES_DB=koji \

View file

@ -39,10 +39,10 @@ def compose_request(distro, koji):
def main(distro):
cr = compose_request(distro, "https://localhost/kojihub")
cr = compose_request(distro, "https://localhost:4343/kojihub")
print(json.dumps(cr))
r = requests.post("https://localhost:8701/compose", json=cr,
r = requests.post("https://localhost/compose", json=cr,
cert=("/etc/osbuild-composer/worker-crt.pem", "/etc/osbuild-composer/worker-key.pem"),
verify="/etc/osbuild-composer/ca-crt.pem")
if r.status_code != 201:
@ -54,7 +54,7 @@ def main(distro):
compose_id = r.json()["id"]
while True:
r = requests.get(f"https://localhost:8701/compose/{compose_id}",
r = requests.get(f"https://localhost/compose/{compose_id}",
cert=("/etc/osbuild-composer/worker-crt.pem", "/etc/osbuild-composer/worker-key.pem"),
verify="/etc/osbuild-composer/ca-crt.pem")
if r.status_code != 200:

View file

@ -66,17 +66,17 @@ sudo systemctl restart osbuild-composer
sudo systemctl restart osbuild-worker\@1
greenprint "Testing Koji"
koji --server=http://localhost/kojihub --user=osbuild --password=osbuildpass --authtype=password hello
koji --server=http://localhost:8080/kojihub --user=osbuild --password=osbuildpass --authtype=password hello
greenprint "Creating Koji task"
koji --server=http://localhost/kojihub --user kojiadmin --password kojipass --authtype=password make-task image
koji --server=http://localhost:8080/kojihub --user kojiadmin --password kojipass --authtype=password make-task image
greenprint "Pushing compose to Koji"
sudo ./test/image-tests/koji-compose.py "${ID}-${VERSION_ID%.*}"
greenprint "Show Koji task"
koji --server=http://localhost/kojihub taskinfo 1
koji --server=http://localhost/kojihub buildinfo 1
koji --server=http://localhost:8080/kojihub taskinfo 1
koji --server=http://localhost:8080/kojihub buildinfo 1
greenprint "Stopping containers"
sudo ./internal/upload/koji/run-koji-container.sh stop