From 87e84d90535c1d30d9e8b298f18657e4fa7dbdd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 23 Jun 2025 22:09:20 +0200 Subject: [PATCH] ci: replace script tools/test_relay_api.sh by configuration file schemathesis.toml --- .github/workflows/ci.yml | 2 +- schemathesis.toml | 13 ++++++ tools/test_relay_api.sh | 89 ---------------------------------------- 3 files changed, 14 insertions(+), 90 deletions(-) create mode 100644 schemathesis.toml delete mode 100755 tools/test_relay_api.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c85b545b..7c1fae087 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -200,7 +200,7 @@ jobs: --daemon \ ; sleep 5 - ./tools/test_relay_api.sh http://localhost:9000 + schemathesis run --url http://localhost:9000/api ./src/plugins/relay/api/weechat-relay-api.yaml echo '*/quit' >/tmp/weechat-test-api/weechat_fifo_* - name: Code coverage diff --git a/schemathesis.toml b/schemathesis.toml new file mode 100644 index 000000000..d4a0786a2 --- /dev/null +++ b/schemathesis.toml @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2025 Sébastien Helleu +# +# SPDX-License-Identifier: GPL-3.0-or-later + +[parameters] +continue-on-failure = true + +[[operations]] +include-path-regex = "/sync/?.*" +enabled = false + +[auth] +basic = { username = "plain", password = "${RELAY_PASSWORD}" } diff --git a/tools/test_relay_api.sh b/tools/test_relay_api.sh deleted file mode 100755 index 68345f997..000000000 --- a/tools/test_relay_api.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# -# SPDX-FileCopyrightText: 2024-2025 Sébastien Helleu -# -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of WeeChat, the extensible chat client. -# -# WeeChat is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# WeeChat is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with WeeChat. If not, see . -# - -# -# Test WeeChat relay HTTP REST API. -# -# Environment variables that can be used: -# -# RELAY_PASSWORD Password for WeeChat relay -# - -set -o errexit - -# default values for options from environment variables -default_relay_password="test" - -usage () -{ - rc=$1 - cat <<-EOF - -Syntax: $0 url - - url URL of the running WeeChat with relay api (without "/api") - -Environment variables used: - - RELAY_PASSWORD password for the relay (default: "${default_relay_password}") - -Example: - - RELAY_PASSWORD="test" $0 http://localhost:9000 - -EOF - exit "${rc}" -} - -error_usage () -{ - echo >&2 "ERROR: $*" - usage 1 -} - -# ================================== START ================================== - -# relay password -[ -z "${RELAY_PASSWORD}" ] && RELAY_PASSWORD="${default_relay_password}" - -# check command line arguments -if [ $# -eq 0 ]; then - usage 0 -fi -if [ $# -lt 1 ]; then - error_usage "missing arguments" -fi - -# command line arguments -url="$1" - -schemathesis run \ - --checks all \ - --show-trace \ - --validate-schema=true \ - --experimental=openapi-3.1 \ - --base-url "${url}/api" \ - --auth "plain:${RELAY_PASSWORD}" \ - ./src/plugins/relay/api/weechat-relay-api.yaml \ - ; - -exit 0