#!/usr/bin/env bash # check-phase19.8: fail-closed gate for Phase 19.8, the console commands # overhaul. It proves the phase across this framework (diary, bonfire and the # swept framework commands), the example application, the docs, every shared # plugin swept in plan 03, every application that runs the new console, the # landing site and the Docker-backed paths. # # Stages: # self-test the go test -json and node --test (TAP) detectors on planted # output (pass, fail, skip, a subtest-only pass, zero tests, "no # tests to run", a missing required name), the additive check # and the NOT SWEPT rule on planted git repositories, the docker # NOT RUN rule on a faked PATH, and that every mode is wired. # go go vet ./... and go test -short ./... here, the required # smoke and unit tests by name per package, then go test -race # -short of diary, sunscreen, bonfire and docsite. # hello the example application (its own module in the workspace): # vet, every test, and its console tests by name. # docs the console decision note names the six charm modules, # TestDocsTree, summer docs:build --check, no consuming # application named in the console and logging sources and # pages, and every command in summer's JSON listing has # examples. # plugins each swept shared plugin (PLUGINS_ROOT, and the user, golem # and feedback checkouts under FONOTEKA): vet, short tests, its # warn-only TestCommandsDocumented by name, a build without the # workspace (GOWORK=off), and the additive check: in the diff of # its sweep commit (found by subject) against its parent no # removed line declares an exported func, method or type, and # no removed Name: "" literal (a command, flag or argument # name) is missing from the added lines. A repository listed in # SWEEP_OPTIONAL without a sweep commit prints NOT SWEPT; any # other one without it fails. Only the short suites run here: # the Docker suites of sitemap, faq, menu and the user plugin's # updates package fail before the sweep too (deferred-items.md) # and are not part of this gate. # apps each application: go build ./... (binaries into a temporary # directory), summer build (this checkout's summer) leaves the # committed main.go and plugins.gen.go unchanged, and # bin/ list and help migrate exit 0. # landing the landing site: nuxt generate, then its node --test suite # (TAP: every test passes, none skipped or todo); the # application's terminal Go tests by name (the end-to-end # TestTerminalCommands only with SUMMERCMS_TERMINAL_CHECK=1, # NOT RUN otherwise); the demo # application's roadmap tests by name and # scripts/sync-roadmap.sh --check against ROADMAP_REF (default # origin/master: local master carries other sessions' unpushed # planning commits). # docker Docker host only: the testcontainers tests by name without # -short (serve's lifecycle, the migration checklist flags, the # admin token JSON). # # A Go stage exits non-zero on a failing command, or on a go test -json run # that fails, skips a test (a subtest included), matches zero tests, prints # "no tests to run" or misses a required name (a subtest pass never counts # for its parent's name). # # --all runs self-test, go, hello, docs, plugins, apps and landing, then # docker when a Docker daemon answers (NOT RUN docker otherwise, a failure # with PHASE198_REQUIRE_DOCKER=1). # # Environment overrides (default: the sibling checkouts next to this # repository): PHASE198_ROOT (this repository), PLUGINS_ROOT (the directory # holding the sm-*-plugin checkouts), FONOTEKA (the application workspace # that carries the user, golem and feedback plugin checkouts), DEMO_APP, # BM_APP, GRZYBY_APP, SUMMERCMSIO_APP, ROADMAP_REF, PHASE198_REQUIRE_DOCKER. set -euo pipefail unset FORCE_COLOR export NO_COLOR=1 ROOT="${PHASE198_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" PLUGINS_ROOT="${PLUGINS_ROOT:-$ROOT/..}" FONOTEKA="${FONOTEKA:-$ROOT/../fono""teka.go}" DEMO_APP="${DEMO_APP:-$ROOT/../sm-demo-app}" BM_APP="${BM_APP:-$ROOT/../sm-bm-app}" GRZYBY_APP="${GRZYBY_APP:-$ROOT/../sm-grzybyfunkcjonalne-app}" SUMMERCMSIO_APP="${SUMMERCMSIO_APP:-$ROOT/../sm-summercmsio-app}" # --------------------------------------------------------------------------- # Required test names. Each list runs with -run '^(a|b|...)$' and every name # must pass; a name that skips or does not run fails the stage. # go stage (-short). DIARY_TESTS=( # Plan 01. TestDiaryTracerSmoke TestConfigEnvSmoke TestDailyDegradesSmoke # Plan 04: config rules, floors, verbosity, quiet (D-08, D-09). TestConfigRules TestConfigEnvStrings TestDefaultConfig TestComponentFloors TestVerbosityLevels TestQuietConsoleOnly # Plan 04: daily files (D-10). TestDailyRotation TestDailyRetention TestDailyPermissions TestDailyUnwritable TestDailyLazyOpen TestPathConfinement # Plan 04: redaction, the console handler, lifecycle, concurrency (D-12). TestRedactionEveryDriver TestConsoleStripsControlChars TestConsoleComponentPrefix TestConsoleStyledOnlyOnTerminal TestConsoleLevelFromOptions TestForBeforeSetup TestResetRestoresDefault TestNoRecursionWithoutState TestHideOnTTY TestConcurrentWrites # Plan 04: testing/slogtest conformance. TestSlogtestConsoleHandler TestSlogtestPipeline ) SUNSCREEN_TESTS=( # Plan 04: the compatibility entry point. TestInstallDefault TestInstallDefaultUnchanged ) BONFIRE_TESTS=( # Plan 02. TestListTracerSmoke TestHelpSmoke TestListJSONSmoke TestErrorRenderSmoke TestWidgetMatrixSmoke # Plan 04: global options, duplicates, Call (SC-2, D-13). TestPeekGlobals TestGlobalsArgs TestGlobalFlagsAgree TestReservedFlags TestDuplicateNames TestCallNoGlobalsHook # Plan 04: goldens for list, help and errors (D-13, D-14, D-16, D-18). TestListGolden TestListAllGolden TestListJSONGolden TestListStyledGolden TestHelpGolden TestHelpPassthroughGolden TestHelpEqualsHelpFlag TestErrorGolden TestExitCodes TestReportedSilent TestErrorScrubbed TestWrongDirectoryHint TestCheckDocs TestVersionHeader # Plan 04: widgets, live views and prompts (D-03, D-27, D-28). TestWidgetMatrix TestLiveModels TestPromptsNoInteraction TestSecretWithNoInteraction TestConfirmProceed TestPrintAbove ) DOCSITE_TESTS=( # Plan 04: the docs checker reads past the global options. TestCommandWord TestCommandWordGlobals ) CONGA_TESTS=( # Plan 01. TestRiverLoggerUsesDiarySmoke # Plan 04 (D-09). TestRiverLoggerComponent TestRiverLoggerPublishedOverride # Plan 04: worker counters and queue:clear's production question # (D-28, D-29). TestWorkerStats TestQueueClearConfirm ) LAGOON_TESTS=( # Plan 01. TestGormLoggerUsesDiarySmoke # Plan 04 (D-09). TestGormLoggerLevels # Plan 04: the production question and key:generate (D-21, D-25, D-28). TestConfirmProductionNonTTYProceeds TestConfirmProductionInteractiveNo TestForceSkipsConfirm TestKeyGenerateJSON TestKeyGenerateQuiet ) SURF_TESTS=( # Plan 03. TestServeSummarySmoke TestShutdownReportSmoke TestAccessLogSmoke # Plan 04: summary, records, report, graceful stop, route:list --json # (D-04, D-25, D-29). TestServeSummaryLines TestServeRecords TestShutdownReportAborted TestServeGracefulNil TestRouteListJSON # Plan 04: the request log (D-23). TestAccessLogRequestIDCap TestAccessLogDefaultOn TestAccessLogDisabled TestAccessLogNeverLogsPath TestAccessLogComponentHTTP ) FLARE_TESTS=( # Plan 04: Reported failures (D-18). TestFlareReported ) DEV_TESTS=( # Plan 04: summer dev runs serve (D-29). TestStartBinServe TestDevReport TestDevGracefulNil ) SUMMER_TESTS=( # Plan 03. TestCommandsDocumented TestDocsTree # Plan 04: the delegates' help (D-17). TestDelegateExamples ) # hello stage. HELLO_TESTS=( TestBuiltBinaryListsCommands TestGreeterDocumented TestHelpListsServe TestBuiltBinaryUnknownCommandExitsNonZero TestMigrateWithoutDSNFailsLoudly ) # docker stage: testcontainers suites (Postgres). DOCKER_SURF_TESTS=(TestServeLifecycle) DOCKER_LAGOON_TESTS=( TestPendingMigrations TestMigratePretend TestRollbackPretend TestDeferredPurgePretend TestMigrateStatusJSON ) DOCKER_CABANA_TESTS=(TestTokenCreateJSON TestTokenListJSON TestTokenCreateQuietKeepsToken) # plugins stage: the swept repositories (19.8-03-SUMMARY.md, D-20), as # "