From 4f39a33d34d0655afdb62c575df0b03f462fed28 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 16 Sep 2020 18:38:46 +0100 Subject: [PATCH] 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 --- .github/workflows/tests.yml | 2 +- distribution/osbuild-composer-koji.socket | 2 +- internal/upload/koji/koji_test.go | 4 ++-- internal/upload/koji/run-koji-container.sh | 4 ++-- test/image-tests/koji-compose.py | 6 +++--- test/image-tests/koji.sh | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 51dcad5f4..dc04052c4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/distribution/osbuild-composer-koji.socket b/distribution/osbuild-composer-koji.socket index 672155840..bc11020b8 100644 --- a/distribution/osbuild-composer-koji.socket +++ b/distribution/osbuild-composer-koji.socket @@ -3,7 +3,7 @@ Description=OSBuild Composer Koji API socket [Socket] Service=osbuild-composer.service -ListenStream=8701 +ListenStream=443 [Install] WantedBy=sockets.target diff --git a/internal/upload/koji/koji_test.go b/internal/upload/koji/koji_test.go index b59fedf42..38e4de656 100644 --- a/internal/upload/koji/koji_test.go +++ b/internal/upload/koji/koji_test.go @@ -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" diff --git a/internal/upload/koji/run-koji-container.sh b/internal/upload/koji/run-koji-container.sh index 8dc9af1fb..486e0184f 100755 --- a/internal/upload/koji/run-koji-container.sh +++ b/internal/upload/koji/run-koji-container.sh @@ -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 \ diff --git a/test/image-tests/koji-compose.py b/test/image-tests/koji-compose.py index cf5c29e27..943c24061 100755 --- a/test/image-tests/koji-compose.py +++ b/test/image-tests/koji-compose.py @@ -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: diff --git a/test/image-tests/koji.sh b/test/image-tests/koji.sh index 5937a23ae..c301825c8 100755 --- a/test/image-tests/koji.sh +++ b/test/image-tests/koji.sh @@ -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