Skip to content

Update integration tests for the fs command#3091

Merged
pietern merged 2 commits intomainfrom
integration-fs-updates
Jun 19, 2025
Merged

Update integration tests for the fs command#3091
pietern merged 2 commits intomainfrom
integration-fs-updates

Conversation

@pietern
Copy link
Copy Markdown
Contributor

@pietern pietern commented Jun 19, 2025

Changes

  • Fix potential panic
  • Reuse ctx variable

Why

I observed the following panic. The code could access r after a failed assertion here:

r, err := f.Read(ctx, relPath)
assert.NoError(t, err)
defer r.Close()
b, err := io.ReadAll(r)
require.NoError(t, err)
assert.Equal(t, "abc", string(b))

=== FAIL: integration/cmd/fs TestFsCpFileToFile (99.64s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11e4b13]

goroutine 344 [running]:
testing.tRunner.func1.2({0x1450540, 0x25334c0})
	/home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.2.linux-amd64/src/testing/testing.go:1734 +0x21c
testing.tRunner.func1()
	/home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.2.linux-amd64/src/testing/testing.go:1737 +0x35e
panic({0x1450540?, 0x25334c0?})
	/home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.2.linux-amd64/src/runtime/panic.go:792 +0x132
github.com/databricks/cli/integration/cmd/fs_test.assertTargetFile(0xc0004b4540, {0x19b5c60?, 0x2589080?}, {0x19bc0b0?, 0xc00111c980?}, {0x1734a1a?, 0xc0004b4540?})
	/home/runner/work/eng-dev-ecosystem/eng-dev-ecosystem/ext/cli/integration/cmd/fs/cp_test.go:43 +0x93
github.com/databricks/cli/integration/cmd/fs_test.TestFsCpFileToFile.func1(0xc0004b4540)
	/home/runner/work/eng-dev-ecosystem/eng-dev-ecosystem/ext/cli/integration/cmd/fs/cp_test.go:158 +0x2a5
testing.tRunner(0xc0004b4540, 0xc000551170)
	/home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.2.linux-amd64/src/testing/testing.go:1792 +0xf4
created by testing.(*T).Run in goroutine 96
	/home/runner/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.2.linux-amd64/src/testing/testing.go:1851 +0x413

Tests

Tests still pass.

* Fix potential panic
* Reuse ctx variable
Comment thread integration/cmd/fs/cp_test.go Outdated
@pietern pietern temporarily deployed to test-trigger-is June 19, 2025 10:58 — with GitHub Actions Inactive
@pietern
Copy link
Copy Markdown
Contributor Author

pietern commented Jun 19, 2025

Integration test failures unrelated.

@pietern pietern merged commit dcc67e6 into main Jun 19, 2025
9 of 10 checks passed
@pietern pietern deleted the integration-fs-updates branch June 19, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants