#!/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 (the names come from PHASE198_APP_NAMES; NOT RUN # without it), 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 PHASE198_PLUGIN_WORKSPACE, NOT # RUN without it): 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 in PHASE198_APPS (NOT RUN without it): # 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 (PHASE198_LANDING_APP and # PHASE198_LANDING_FRONTEND, NOT RUN without them): nuxt # generate of the frontend, 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 (PHASE198_DEMO_APP, # NOT RUN without it) 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. This framework script names no consuming application: every # application path and the names the docs stage refuses come from the # environment, with no defaults. # PHASE198_ROOT this repository (default: the script's parent). # PLUGINS_ROOT the directory holding the shared sm-*-plugin # checkouts (default: this repository's parent). # PHASE198_PLUGIN_WORKSPACE the application workspace that carries the # user, golem and feedback plugin checkouts # under plugins/golem15/. # PHASE198_APPS space-separated application checkout paths # for the apps stage (labelled by basename). # PHASE198_DEMO_APP the demo application (roadmap check). # PHASE198_LANDING_APP the landing site application (terminal tests). # PHASE198_LANDING_FRONTEND the landing site frontend (nuxt generate, # node --test). # PHASE198_APP_NAMES space-separated ERE patterns of consuming # application names the docs stage refuses. # PHASE198_REQUIRE_SIBLINGS 1 turns every NOT RUN for an unset variable # above into a failure. # ROADMAP_REF, PHASE198_REQUIRE_DOCKER, SUMMERCMS_TERMINAL_CHECK. # A stage or sub-check whose variable is unset prints "NOT RUN : set # " (a failure with PHASE198_REQUIRE_SIBLINGS=1), the way the docker # stage treats 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/..}" PLUGIN_WORKSPACE="${PHASE198_PLUGIN_WORKSPACE:-}" DEMO_APP="${PHASE198_DEMO_APP:-}" LANDING_APP="${PHASE198_LANDING_APP:-}" LANDING_FRONTEND="${PHASE198_LANDING_FRONTEND:-}" # --------------------------------------------------------------------------- # 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 # Plan 05 (review fixes): daily retry, retired writers (WR-04, WR-06). TestDailyRetriesAfterFailure TestRetiredDailyWriterKeepsNoFile TestApplyGlobalsRebuildsOnce # quick 261028-rqd (info findings): IN-01, IN-07. TestConsoleHideOnTTYTerminal TestDiaryDoesNotLinkTheConsoleStack ) 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 # Plan 05 (review fixes): live views (CR-01, WR-01, WR-02), exit codes # (CR-02), the masked hint (WR-08), control characters (WR-05). TestPrintAboveOrderedNoLoss TestPrintlnStaysWithItsConsole TestLiveViewSingleOwner TestLiveViewPanicUnregisters TestLiveViewRestoresTerminalOnSignal TestWithExitCode TestWrongDirectoryMasksSecrets TestSanitize TestRenderErrorStripsControl TestProcessViewStripsControl TestTableStripsControl # quick 261022-4z8 (re-review fixes): IN-15, WR-09. TestNestedProcessBuildsNoProgram TestPrintAboveAfterCancel # quick 261028-rqd (info findings): IN-03, IN-06, IN-02, IN-04. TestPluginErrorWordedUnknownCommand TestExecuteKeepsRootHelp TestErrorBlockUsesParsedGlobals TestFlagBool # quick 261028-rqd: IN-11, IN-10, IN-12, IN-13. TestPrintAboveBlankLine TestErrorPrintsAboveView TestSignalRelayWaitsForStart TestErrWriter ) 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 # Plan 05 (review fixes): serve's full shutdown grace (WR-03). TestDevStopWaitsForGracefulShutdown ) SUMMER_TESTS=( # Plan 03. TestCommandsDocumented TestDocsTree # Plan 04: the delegates' help (D-17). TestDelegateExamples # Plan 05 (review fixes): delegate exit codes and streams (CR-02, CR-03). TestDelegateExitCodePassthrough TestAppStreams TestDelegateStreams # quick 261022-4z8 (re-review fixes): WR-10. TestRunAppCmdMasksSecrets # quick 261028-rqd: WR-10 follow-up (exit 128+n). TestDelegateSignalExitCodes ) # 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 # Plan 05 (review fixes): applied lines from one set list (WR-07). TestMigrateAppliedLines # quick 261022-4z8 (re-review fixes): WR-13. TestMigrateRereadFailureWarns # quick 261022-4z8: WR-12 rework, lagoon.Status stays plugin-only. TestStatusPluginRows ) DOCKER_CABANA_TESTS=(TestTokenCreateJSON TestTokenListJSON TestTokenCreateQuietKeepsToken) # plugins stage: the swept repositories (19.8-03-SUMMARY.md, D-20), as # "