From 513793a13d9c90ad1fb1a620afcee404d343a0bb Mon Sep 17 00:00:00 2001 From: Jakub Zych Date: Wed, 4 Nov 2026 19:54:54 +0100 Subject: [PATCH] test: phase 33 gate, Go stages - go: the framework's new unit tests by required name - plugins: the sitemap, SEO and Journal unit tests by required name - docker: the phase's Postgres suites by required name per plugin, TestChromeRenderer when a Chrome or Chromium binary is present, and the framework's lagoon/attach packages --- scripts/check-phase33.sh | 86 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/scripts/check-phase33.sh b/scripts/check-phase33.sh index 21003ac4..4eaeb7fe 100755 --- a/scripts/check-phase33.sh +++ b/scripts/check-phase33.sh @@ -14,7 +14,8 @@ # framework tests of the phase by required name (GO_TESTS). # plugins sm-sitemap-plugin, sm-seo-plugin and sm-journal-plugin: the # workspace check (the framework resolves to this checkout), -# go vet and go test -short; npm run test (vitest) in +# go vet, go test -short and the unit tests of plan 33-14 by +# required name (*_UNIT_TESTS); npm run test (vitest) in # sm-seo-plugin and sm-journal-plugin. # layers vue-seo-layer, vue-journal-layer, vue-menu-layer and # vue-faq-layer: npm run test, npm run build:playground and the @@ -24,7 +25,10 @@ # sm-bm-app: the workspace check and go build ./...; npm run # build in each Nuxt app (vue-*/ with a build script). # docker Docker host only: the Postgres suites (go test ./... without -# -short) of the three Go plugins. +# -short) of the three Go plugins with the phase's suites by +# required name (*_DOCKER_TESTS; TestChromeRenderer too when a +# Chrome or Chromium binary is on the host, else it is printed +# as NOT RUN), and the framework's modules/lagoon/attach/... # admin scripts/check-admin-openapi.sh --check and # scripts/check-admin-dist.sh. # docs TestDocsTree and summer docs:build --check. @@ -107,8 +111,44 @@ MCP_TAG="summercms_mcp" GO_TESTS=( ./modules/signpost:TestContentDescriptorFields ./modules/signpost:TestContentLookups ./modules/cabana:TestFieldTypeRequestOptions ./modules/cabana:TestFormExtensionUnextendedSchemaUnchanged + ./modules/cabana:TestMergeRequestOptions ./modules/cabana:TestMergeRequestOptionsNoFields + ./modules/pact:TestContentKindAndToolValues ./modules/pact:TestContentRecordZeroFacts ./modules/pact:TestContentValueTypes + ./modules/lagoon/attach:TestVariantKeyTable ./modules/lagoon/attach:TestVariantKeyOfThumbFilename + ./modules/lagoon/attach/webp:TestEncodeImageKinds ./modules/lagoon/attach/webp:TestEncodeConstants + ./modules/lagoon/attach/webp:TestVariantStoredWithContentType ./modules/lagoon/attach/webp:TestVariantBrokenAndRefused ) +# plugins stage: the Docker-free unit tests of plan 33-14 by required name +# (-short), per plugin. +SITEMAP_UNIT_TESTS=( + ./classes:TestWriteURLSet ./classes:TestWriteIndex ./classes:TestWriteImageURLSet ./classes:TestFileNamesRoundTrip ./classes:TestValidSlug + ./classes:TestAssignSlots ./classes:TestAssignSlotsEdges ./classes:TestRealChanges ./classes:TestLastmodIgnore ./classes:TestRebuildDelay + ./classes:TestNewsLimits ./classes:TestParseNewsSources ./classes:TestNewsSourcesMatch ./classes:TestNewsLanguage ./classes:TestWriteNewsURLSet + ./classes:TestIndexNowBatches ./classes:TestIndexNowOutcome ./classes:TestIndexNowKeys ./classes:TestSiteURLs + ./classes:TestHTMLGroupOrder ./classes:TestTreeOrder ./classes:TestNestPaging ./classes:TestToEntries + ./classes:TestDefaultSlug ./classes:TestEffectiveType ./classes:TestMarkListedExtras +) +SEO_UNIT_TESTS=( + ./classes/schema:TestDefaultAndAllowedTypes ./classes/schema:TestPageIDs ./classes/schema:TestBuildArticle ./classes/schema:TestBuildPerKind + ./classes/schema:TestPublisherNode ./classes/schema:TestValidateNodeRules ./classes/schema:TestDecodeCustom ./classes/schema:TestNormalize ./classes/schema:TestMerge + ./classes:TestParsePage ./classes:TestPageLocation ./classes:TestAlternates ./classes:TestPrimaryParent ./classes:TestCandidatePath + ./classes:TestValidPagePath ./classes:TestApplyPageFields ./classes:TestPageGroupAndMissing ./classes:TestPageBeforeSaveUTC ./classes:TestValidAutolinkURL + ./classes/crawl:TestParseFacts ./classes/crawl:TestCheckStatus ./classes/crawl:TestCheckHead ./classes/crawl:TestCheckHeadings ./classes/crawl:TestCheckJSONLD + ./classes/crawl:TestCheckImages ./classes/crawl:TestCheckContentCMS ./classes/crawl:TestRoute ./classes/crawl:TestRouteEveryKind + ./classes/crawl:TestCompareRendered ./classes/crawl:TestAllowRequest ./classes/crawl:TestResolverRules ./classes/crawl:TestNewRenderer +) +JOURNAL_UNIT_TESTS=( + ./classes:TestConvertH1 ./classes:TestConvertContentH1 ./classes:TestConvertTranslationH1 ./classes:TestSetImageAlt ./classes:TestSetImageAltEdges + ./classes:TestParseContentFacts ./classes:TestParseContentFactsEmpty ./classes:TestTopHeading ./classes:TestReadRelatedSettings +) + +# docker stage: the Postgres suites of the phase by required name, per +# plugin (each plugin's go test ./... must pass them). TestChromeRenderer is +# required when a Chrome or Chromium binary is on this host. +SITEMAP_DOCKER_TESTS=(TestSitemapIndex TestExtraDuplicates TestImageSitemap TestNewsSitemap TestIndexNow TestHTMLGroups TestFilterExcludes TestHreflangAlternates TestLastmod TestMigrateDefinitions TestSitemapTools TestRebuildCommand) +SEO_DOCKER_TESTS=(TestRegistry TestRegistryTimestampsUTC TestRouteReport TestSiteEndpoint TestSitemapFilterTracer TestFilterReasons TestGraphTracer TestGraphPerKind TestPagination TestPagedAlternates TestCustomJSONLD TestCrawlerTracer TestCrawlerChecks TestRenderSkipped TestAutolinks TestLinkSuggestions) +JOURNAL_DOCKER_TESTS=(TestHeadingConversionTracer TestHeadingConversion TestFixHeadingsCommand TestSetImageAlt TestJournalDescriptorFields TestImageVariants TestImageVariantsCommandCLI TestJournalAPIShowNeighbors) + # marker stage: SEO words and the names of consuming applications (split so # this file does not match itself). MARKER_WORDS=("\\bs""eo\\b" "site""map" "json-?l""d") @@ -643,6 +683,9 @@ run_plugins() { go_vet "$dir" ./... go_short "$dir" done + go_pkg_named "$SITEMAP_PLUGIN" "-short" "${SITEMAP_UNIT_TESTS[@]}" + go_pkg_named "$SEO_PLUGIN" "-short" "${SEO_UNIT_TESTS[@]}" + go_pkg_named "$JOURNAL_PLUGIN" "-short" "${JOURNAL_UNIT_TESTS[@]}" npm_vitest "$SEO_PLUGIN" npm_vitest "$JOURNAL_PLUGIN" echo "phase33 plugins passed" @@ -689,13 +732,44 @@ run_docker() { return 1 fi require_all "Go plugin" "$SITEMAP_PLUGIN" "$SEO_PLUGIN" "$JOURNAL_PLUGIN" - for dir in "$SITEMAP_PLUGIN" "$SEO_PLUGIN" "$JOURNAL_PLUGIN"; do - workspace_check "$dir" - go_json "$dir" -count=1 -timeout 30m ./... - done + local seo_required=("${SEO_DOCKER_TESTS[@]}") seo_skip=() + if chrome_binary >/dev/null; then + seo_required+=(TestChromeRenderer) + echo "chrome: $(chrome_binary) (TestChromeRenderer required)" + else + seo_skip=(-skip '^TestChromeRenderer$') + echo "NOT RUN TestChromeRenderer: no Chrome or Chromium on this host (set SEO_TEST_CHROME)" + fi + workspace_check "$SITEMAP_PLUGIN" + REQUIRE_TESTS="${SITEMAP_DOCKER_TESTS[*]}" go_json "$SITEMAP_PLUGIN" -count=1 -timeout 30m ./... + workspace_check "$SEO_PLUGIN" + REQUIRE_TESTS="${seo_required[*]}" go_json "$SEO_PLUGIN" -count=1 -timeout 30m "${seo_skip[@]}" ./... + workspace_check "$JOURNAL_PLUGIN" + REQUIRE_TESTS="${JOURNAL_DOCKER_TESTS[*]}" go_json "$JOURNAL_PLUGIN" -count=1 -timeout 30m ./... + # The framework's attachment and WebP packages with their Postgres + # suites (33-11). + go_json "$ROOT" -count=1 -timeout 30m ./modules/lagoon/attach/... echo "phase33 docker passed" } +# chrome_binary prints the Chrome or Chromium binary TestChromeRenderer +# uses (SEO_TEST_CHROME, else chromium, chromium-browser, google-chrome on +# PATH) and fails when there is none. +chrome_binary() { + if [[ -n "${SEO_TEST_CHROME:-}" ]]; then + printf '%s\n' "$SEO_TEST_CHROME" + return 0 + fi + local name + for name in chromium chromium-browser google-chrome; do + if command -v "$name" >/dev/null 2>&1; then + command -v "$name" + return 0 + fi + done + return 1 +} + # docker_gate is the docker step of --all: run the stage when a daemon # answers, fail with PHASE33_REQUIRE_DOCKER=1, print NOT RUN otherwise. docker_gate() {