From 26fe6e4459f791ed6796d66e6eee578f1f10911a Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Fri, 11 Sep 2026 17:06:11 +0200 Subject: [PATCH 1/2] Limit lines per LOG file in acceptance tests Invariant tests write large LOG.planjson files that flood the test log and overflow log viewers. Cap each LOG.* file to 100 lines on CI and 1000 otherwise, configurable via DATABRICKS_CLI_TEST_MAX_LOG. Co-authored-by: Isaac --- acceptance/acceptance_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 4da55ccd983..ce8ea02fe32 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -119,6 +119,24 @@ const ( var ApplyCITimeoutMultipler = os.Getenv("GITHUB_WORKFLOW") != "" +// MaxLogLines caps how many lines of each LOG.* file the harness echoes into the test +// log. Some invariant tests write very large LOG.planjson files that otherwise drown out +// the rest of the logs and overflow log viewers. Override with DATABRICKS_CLI_TEST_MAX_LOG; +// a value <= 0 disables the limit. +var MaxLogLines = func() int { + if v := os.Getenv("DATABRICKS_CLI_TEST_MAX_LOG"); v != "" { + n, err := strconv.Atoi(v) + if err != nil { + panic("invalid DATABRICKS_CLI_TEST_MAX_LOG=" + v + ": " + err.Error()) + } + return n + } + if ApplyCITimeoutMultipler { + return 100 + } + return 1000 +}() + var exeSuffix = func() string { if runtime.GOOS == "windows" { return ".exe" @@ -1048,6 +1066,7 @@ func runTest(t *testing.T, prefix := relPath + ": " messages := testutil.ReadFile(t, filepath.Join(tmpDir, relPath)) messages = strings.TrimRight(messages, "\r\n \t") + messages = truncateLines(messages, MaxLogLines) messages = prefix + strings.ReplaceAll(messages, "\n", "\n"+prefix) if strings.Contains(messages, "\n") { messages = "\n" + messages @@ -1068,6 +1087,21 @@ func runTest(t *testing.T, } } +// truncateLines keeps at most maxLines lines of s, appending a note about how many were +// dropped. maxLines <= 0 disables truncation. +func truncateLines(s string, maxLines int) string { + if maxLines <= 0 { + return s + } + lines := strings.Split(s, "\n") + if len(lines) <= maxLines { + return s + } + dropped := len(lines) - maxLines + kept := strings.Join(lines[:maxLines], "\n") + return fmt.Sprintf("%s\n... (%d more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)", kept, dropped) +} + // checkEnvFilters skips the test if any env filter doesn't match testEnv. Filters that // share a key are alternatives, so INPUT_CONFIG=a together with INPUT_CONFIG=b runs both // variants rather than neither (see selection.MatchesFilters). From ffd540cce4f430910a62a3df5418cb79e0bcfe90 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Tue, 15 Sep 2026 12:57:14 +0200 Subject: [PATCH 2/2] ApplyCITimeoutMultipler -> IsRunningOnCI --- acceptance/acceptance_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index ce8ea02fe32..777d2017aac 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -117,7 +117,7 @@ const ( ReplsEnvVar = "ACC_REPLS" ) -var ApplyCITimeoutMultipler = os.Getenv("GITHUB_WORKFLOW") != "" +var IsRunningOnCI = os.Getenv("GITHUB_WORKFLOW") != "" // MaxLogLines caps how many lines of each LOG.* file the harness echoes into the test // log. Some invariant tests write very large LOG.planjson files that otherwise drown out @@ -131,7 +131,7 @@ var MaxLogLines = func() int { } return n } - if ApplyCITimeoutMultipler { + if IsRunningOnCI { return 100 } return 1000 @@ -880,7 +880,7 @@ func runTest(t *testing.T, timeout = max(timeout, config.TimeoutCloud) } - if ApplyCITimeoutMultipler { + if IsRunningOnCI { timeout = time.Duration(float64(timeout) * config.TimeoutCIMultiplier) }