From 50ad14d5492e9309f2821afc27a6e7dedd967c21 Mon Sep 17 00:00:00 2001 From: Trustable User Date: Mon, 13 Jul 2026 11:24:44 +0200 Subject: [PATCH] Test automatic IDE runtime builds --- test-ide-deployer/package.json | 15 ++++++ test-ide-deployer/runtime/python-custom.txt | 1 + tests/15-ide-deployer.sh | 60 +++++++++++++++++++++ tests/all.sh | 7 +++ 4 files changed, 83 insertions(+) create mode 100644 test-ide-deployer/package.json create mode 100644 test-ide-deployer/runtime/python-custom.txt create mode 100755 tests/15-ide-deployer.sh diff --git a/test-ide-deployer/package.json b/test-ide-deployer/package.json new file mode 100644 index 0000000..34ccbf5 --- /dev/null +++ b/test-ide-deployer/package.json @@ -0,0 +1,15 @@ +{ + "name": "openserverless-ide-deployer-test", + "private": true, + "openserverless": { + "runtimeProfiles": { + "python-custom": { + "builder": "python:3.13", + "requirements": "runtime/python-custom.txt", + "actions": [ + "runtimeprofiletest/custom-runtime" + ] + } + } + } +} diff --git a/test-ide-deployer/runtime/python-custom.txt b/test-ide-deployer/runtime/python-custom.txt new file mode 100644 index 0000000..b24d3e2 --- /dev/null +++ b/test-ide-deployer/runtime/python-custom.txt @@ -0,0 +1 @@ +pyfiglet==1.0.4 diff --git a/tests/15-ide-deployer.sh b/tests/15-ide-deployer.sh new file mode 100755 index 0000000..9951a5a --- /dev/null +++ b/tests/15-ide-deployer.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -eu +set -o pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_DIR="$SCRIPT_DIR/../test-ide-deployer" +ACTION="runtimeprofiletest/custom-runtime" + +cd "$PROJECT_DIR" + +ops ide deploy --packages + +action_json=$(ops action get "$ACTION" | sed -n '/^{/,$p') +image=$(printf '%s\n' "$action_json" | jq -r '.exec.image // empty') +if test -z "$image" +then + echo "FAIL CUSTOM RUNTIME IMAGE" + exit 1 +fi + +if ops -wsk action invoke "$ACTION" -p value ready -r | grep -q '"dependency": "1.0.4"' +then + echo "SUCCESS CUSTOM RUNTIME INVOCATION" +else + echo "FAIL CUSTOM RUNTIME INVOCATION" + exit 1 +fi + +jobs_before=$(kubectl -n nuvolaris get jobs \ + -l openserverless.apache.org/component=runtime-builder \ + --no-headers 2>/dev/null | wc -l | tr -d ' ') +ops ide deploy --packages +jobs_after=$(kubectl -n nuvolaris get jobs \ + -l openserverless.apache.org/component=runtime-builder \ + --no-headers 2>/dev/null | wc -l | tr -d ' ') + +if test "$jobs_before" = "$jobs_after" +then + echo "SUCCESS CUSTOM RUNTIME CACHE" +else + echo "FAIL CUSTOM RUNTIME CACHE" + exit 1 +fi diff --git a/tests/all.sh b/tests/all.sh index b1457e7..385a1dc 100755 --- a/tests/all.sh +++ b/tests/all.sh @@ -156,6 +156,13 @@ echo "# #" echo "##############################################" collect ./14-runtime-testing.sh $TYPE +echo "##############################################" +echo "# #" +echo "# TESTING OPS IDE DEPLOYER $TYPE #" +echo "# #" +echo "##############################################" +collect ./15-ide-deployer.sh $TYPE + echo "============================================" cat _results exit "$FAILED"