From 73b8118f8a0be066acc42c9247703d8ea7cda880 Mon Sep 17 00:00:00 2001 From: Francisco de Paz Galan Date: Thu, 25 May 2023 13:46:30 +0200 Subject: [PATCH] [bitnami/clickhouse] Add VIB tests (#34547) * [bitnami/clickhouse] Add VIB tests Signed-off-by: FraPazGal * Modify server check Signed-off-by: FraPazGal * Fix output pipeline for test Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal * Apply suggestions and trigger VIB Signed-off-by: FraPazGal * Remove VIB trigger Signed-off-by: FraPazGal --------- Signed-off-by: FraPazGal --- .vib/clickhouse/goss/clickhouse.yaml | 39 ++++++++++++++++++++++++++++ .vib/clickhouse/goss/goss.yaml | 13 ++++++++++ .vib/clickhouse/goss/vars.yaml | 27 +++++++++++++++++++ .vib/clickhouse/vib-publish.json | 24 ++++++++++++++--- .vib/clickhouse/vib-verify.json | 18 ++++++++++++- 5 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 .vib/clickhouse/goss/clickhouse.yaml create mode 100644 .vib/clickhouse/goss/goss.yaml create mode 100644 .vib/clickhouse/goss/vars.yaml diff --git a/.vib/clickhouse/goss/clickhouse.yaml b/.vib/clickhouse/goss/clickhouse.yaml new file mode 100644 index 000000000000..45dabba703ee --- /dev/null +++ b/.vib/clickhouse/goss/clickhouse.yaml @@ -0,0 +1,39 @@ +command: + # Force the exit-status as the timeout's original return varies between 0 and 143. + check-clickhouse-server: + exec: timeout --preserve-status 5 clickhouse-server 2>&1 || true + exit-status: 0 + stdout: + - Ready for connections +file: + /var/lib/clickhouse/tmp: + exists: true + filetype: symlink + linked-to: /opt/bitnami/clickhouse/tmp + /opt/bitnami/clickhouse/logs/clickhouse.log: + exists: true + filetype: symlink + linked-to: /dev/stdout + /opt/bitnami/clickhouse/logs/clickhouse_error.log: + exists: true + filetype: symlink + linked-to: /dev/stderr + /opt/bitnami/clickhouse/etc/config.xml: + exists: true + filetype: file + contains: + - /data dir.*\/bitnami\/clickhouse\/data/ + - /http_port.*from_env.*CLICKHOUSE_HTTP_PORT/ + - "!remote_servers" + - "1" + /opt/bitnami/clickhouse/etc/users.xml: + exists: true + filetype: file + contains: + - /password.*from_env.*CLICKHOUSE_ADMIN_PASSWORD/ +group: + clickhouse: + exists: true +user: + clickhouse: + exists: true diff --git a/.vib/clickhouse/goss/goss.yaml b/.vib/clickhouse/goss/goss.yaml new file mode 100644 index 000000000000..9c0f0080b1c4 --- /dev/null +++ b/.vib/clickhouse/goss/goss.yaml @@ -0,0 +1,13 @@ +gossfile: + # Goss tests exclusive to the current container + ../../clickhouse/goss/clickhouse.yaml: {} + # Load scripts from .vib/common/goss/templates + ../../common/goss/templates/check-app-version.yaml: {} + ../../common/goss/templates/check-binaries.yaml: {} + ../../common/goss/templates/check-broken-symlinks.yaml: {} + ../../common/goss/templates/check-ca-certs.yaml: {} + ../../common/goss/templates/check-directories.yaml: {} + ../../common/goss/templates/check-files.yaml: {} + ../../common/goss/templates/check-linked-libraries.yaml: {} + ../../common/goss/templates/check-sed-in-place.yaml: {} + ../../common/goss/templates/check-spdx.yaml: {} diff --git a/.vib/clickhouse/goss/vars.yaml b/.vib/clickhouse/goss/vars.yaml new file mode 100644 index 000000000000..31fcd8078e3c --- /dev/null +++ b/.vib/clickhouse/goss/vars.yaml @@ -0,0 +1,27 @@ +binaries: + - clickhouse + - clickhouse-client + - clickhouse-local + - clickhouse-server +directories: + - mode: "0775" + owner: clickhouse + group: root + paths: + - /bitnami/clickhouse/data + - /opt/bitnami/clickhouse/etc + - /opt/bitnami/clickhouse/etc/conf.d + - /opt/bitnami/clickhouse/etc/users.d + - /opt/bitnami/clickhouse/logs + - /opt/bitnami/clickhouse/tmp + - /bitnami/clickhouse/etc + - /docker-entrypoint-startdb.d + - /docker-entrypoint-initdb.d +files: + - mode: "0664" + paths: + - /.clickhouse-client-history +root_dir: /opt/bitnami +version: + bin_name: clickhouse-server + flag: --version diff --git a/.vib/clickhouse/vib-publish.json b/.vib/clickhouse/vib-publish.json index 1e2aad8ef471..25fc0b4e0c7b 100644 --- a/.vib/clickhouse/vib-publish.json +++ b/.vib/clickhouse/vib-publish.json @@ -3,7 +3,8 @@ "resources": { "url": "{VIB_ENV_CONTAINER_URL}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -64,9 +65,24 @@ "url": "{VIB_ENV_PACKAGES_JSON_URL}", "path": "/{VIB_ENV_PATH}", "authn": { - "header": "Authorization", - "token": "Bearer {VIB_ENV_GITHUB_TOKEN}" - } + "header": "Authorization", + "token": "Bearer {VIB_ENV_GITHUB_TOKEN}" + } + } + } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "clickhouse/goss/goss.yaml", + "vars_file": "clickhouse/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-clickhouse" + } } } } diff --git a/.vib/clickhouse/vib-verify.json b/.vib/clickhouse/vib-verify.json index a34e8aee9161..b153b6333be4 100644 --- a/.vib/clickhouse/vib-verify.json +++ b/.vib/clickhouse/vib-verify.json @@ -3,7 +3,8 @@ "resources": { "url": "{SHA_ARCHIVE}", "path": "{VIB_ENV_PATH}" - } + }, + "runtime_parameters": "Y29tbWFuZDogWyJ0YWlsIiwgIi1mIiwgIi9kZXYvbnVsbCJd" }, "phases": { "package": { @@ -46,6 +47,21 @@ "OS" ] } + }, + { + "action_id": "goss", + "params": { + "resources": { + "path": "/.vib" + }, + "tests_file": "clickhouse/goss/goss.yaml", + "vars_file": "clickhouse/goss/vars.yaml", + "remote": { + "pod": { + "workload": "deploy-clickhouse" + } + } + } } ] }