* add passwd for psql local query and add server/postgres logs for debugging

* set license for smoke tests

* fix fmt
Этот коммит содержится в:
sabril
2025-06-10 11:45:29 +08:00
коммит произвёл GitHub
родитель aac34f6db4
Коммит 5756643256
7 изменённых файлов: 66 добавлений и 40 удалений

2
.github/workflows/e2e-tests-ci.yml поставляемый
Просмотреть файл

@@ -15,3 +15,5 @@ jobs:
with: with:
commit_sha: "${{ inputs.commit_sha }}" commit_sha: "${{ inputs.commit_sha }}"
status_check_context: "E2E Tests/smoketests" status_check_context: "E2E Tests/smoketests"
secrets:
MM_LICENSE: "${{ secrets.MM_E2E_TEST_LICENSE_ONPREM_ENT }}"

Просмотреть файл

@@ -56,20 +56,27 @@ if [ -n "${TM4J_API_KEY:-}" ]; then
# Assert that the test type is among the ones supported by Zephyr, and select the corresponding folderId # Assert that the test type is among the ones supported by Zephyr, and select the corresponding folderId
case "${SERVER}-${TYPE}" in case "${SERVER}-${TYPE}" in
onprem-RELEASE) onprem-RELEASE)
export TM4J_FOLDER_ID="2014475" ;; export TM4J_FOLDER_ID="2014475"
;;
onprem-MASTER) onprem-MASTER)
export TM4J_FOLDER_ID="2014476" ;; export TM4J_FOLDER_ID="2014476"
;;
onprem-MASTER_UNSTABLE) onprem-MASTER_UNSTABLE)
export TM4J_FOLDER_ID="2014478" ;; export TM4J_FOLDER_ID="2014478"
;;
cloud-RELEASE) cloud-RELEASE)
export TM4J_FOLDER_ID="2014474" ;; export TM4J_FOLDER_ID="2014474"
;;
cloud-CLOUD) cloud-CLOUD)
export TM4J_FOLDER_ID="2014479" ;; export TM4J_FOLDER_ID="2014479"
;;
cloud-CLOUD_UNSTABLE) cloud-CLOUD_UNSTABLE)
export TM4J_FOLDER_ID="2014481" ;; export TM4J_FOLDER_ID="2014481"
;;
*) *)
mme2e_log "Error: unsupported Zephyr environment for the requested report (SERVER=${SERVER}, TYPE=${TYPE}). Aborting." >&2 mme2e_log "Error: unsupported Zephyr environment for the requested report (SERVER=${SERVER}, TYPE=${TYPE}). Aborting." >&2
exit 1 exit 1
;;
esac esac
: ${TEST_CYCLE_LINK_PREFIX:?} : ${TEST_CYCLE_LINK_PREFIX:?}
: ${TM4J_CYCLE_KEY:-} # Optional. Populated automatically by the reporting script : ${TM4J_CYCLE_KEY:-} # Optional. Populated automatically by the reporting script

Просмотреть файл

@@ -8,8 +8,7 @@ for SETTING in \
TeamSettings.EnableOpenServer=true \ TeamSettings.EnableOpenServer=true \
PluginSettings.Enable=true \ PluginSettings.Enable=true \
PluginSettings.EnableUploads=true \ PluginSettings.EnableUploads=true \
PluginSettings.AutomaticPrepackagedPlugins=true PluginSettings.AutomaticPrepackagedPlugins=true; do
do
mme2e_log "Configuring parameter: $SETTING" mme2e_log "Configuring parameter: $SETTING"
# shellcheck disable=SC2046 # shellcheck disable=SC2046
${MME2E_DC_SERVER} exec -T -- server mmctl --local config set $(tr '=' ' ' <<<$SETTING) ${MME2E_DC_SERVER} exec -T -- server mmctl --local config set $(tr '=' ' ' <<<$SETTING)
@@ -34,8 +33,7 @@ if [ "$TEST" = "cypress" ]; then
for PLUGIN_URL in \ for PLUGIN_URL in \
"https://github.com/mattermost/mattermost-plugin-gitlab/releases/download/v1.3.0/com.github.manland.mattermost-plugin-gitlab-1.3.0.tar.gz" \ "https://github.com/mattermost/mattermost-plugin-gitlab/releases/download/v1.3.0/com.github.manland.mattermost-plugin-gitlab-1.3.0.tar.gz" \
"https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.9.0/com.mattermost.demo-plugin-0.9.0.tar.gz" \ "https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.9.0/com.mattermost.demo-plugin-0.9.0.tar.gz" \
"https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.8.0/com.mattermost.demo-plugin-0.8.0.tar.gz" "https://github.com/mattermost/mattermost-plugin-demo/releases/download/v0.8.0/com.mattermost.demo-plugin-0.8.0.tar.gz"; do
do
PLUGIN_NAME="${PLUGIN_URL##*/}" PLUGIN_NAME="${PLUGIN_URL##*/}"
PLUGIN_PATH="tests/fixtures/$PLUGIN_NAME" PLUGIN_PATH="tests/fixtures/$PLUGIN_NAME"

Просмотреть файл

@@ -11,6 +11,13 @@ mme2e_wait_image "$SERVER_IMAGE" 4 30
mme2e_log "Starting E2E containers" mme2e_log "Starting E2E containers"
${MME2E_DC_SERVER} create ${MME2E_DC_SERVER} create
${MME2E_DC_SERVER} up -d --remove-orphans ${MME2E_DC_SERVER} up -d --remove-orphans
# Postgres check
if ! mme2e_wait_command_success "${MME2E_DC_SERVER} exec -T -- postgres pg_isready -h localhost" "Waiting for postgres to accept connections" "30" "5"; then
mme2e_log "Postgres not accepting connections"
exit 1
fi
if ! mme2e_wait_service_healthy server 60 10; then if ! mme2e_wait_service_healthy server 60 10; then
mme2e_log "Mattermost container not healthy, retry attempts exhausted. Giving up." >&2 mme2e_log "Mattermost container not healthy, retry attempts exhausted. Giving up." >&2
exit 1 exit 1
@@ -18,9 +25,21 @@ fi
# shellcheck disable=SC2043 # shellcheck disable=SC2043
for MIGRATION in migration_advanced_permissions_phase_2; do for MIGRATION in migration_advanced_permissions_phase_2; do
# Query explanation: if it doesn't find the migration in the table, there are 0 results and the command fails with a divide-by-zero error. Otherwise the command succeeds # Query explanation: if it doesn't find the migration in the table, there are 0 results and the command fails with a divide-by-zero error. Otherwise the command succeeds
MIGRATION_CHECK_COMMAND="${MME2E_DC_SERVER} exec -T -- postgres psql -U mmuser mattermost_test -c \"select 1 / (select count(*) from Systems where name = '${MIGRATION}' and value = 'true');\"" MIGRATION_CHECK_COMMAND="${MME2E_DC_SERVER} exec -T postgres sh -c 'PGPASSWORD=mostest psql -U mmuser mattermost_test -c \"select 1 / (select count(*) from Systems where name = '\''${MIGRATION}'\'' and value = '\''true'\'');\"'"
if ! mme2e_wait_command_success "$MIGRATION_CHECK_COMMAND >/dev/null 2>&1" "Waiting for migration to be completed: ${MIGRATION}" "30" "10"; then if ! mme2e_wait_command_success "$MIGRATION_CHECK_COMMAND" "Waiting for migration to be completed: ${MIGRATION}" "10" "10"; then
mme2e_log "Migration ${MIGRATION} not completed, retry attempts exhausted. Giving up." >&2 mme2e_log "Migration ${MIGRATION} not completed, retry attempts exhausted. Giving up." >&2
LOG_DIR="../${TEST}/logs"
mkdir -p "$LOG_DIR"
# Save server logs to a file
${MME2E_DC_SERVER} logs --no-log-prefix -- server >"$LOG_DIR/server.log"
mme2e_log "Server logs saved to server.log"
# Save postgres logs to a file
${MME2E_DC_SERVER} logs --no-log-prefix -- postgres >"$LOG_DIR/postgres.log"
mme2e_log "Postgres logs saved to postgres.log"
exit 2 exit 2
fi fi
mme2e_log "${MIGRATION}: completed." mme2e_log "${MIGRATION}: completed."