package harness
import "k8s.io/kubernetes/test/utils/harness"
Index ¶
Types ¶
type Harness ¶
Harness adds some functionality to testing.T, in particular resource cleanup. It embeds testing.T, so should have the same signature.
Example usage: ```
func MyTest(tt *testing.T) { t := harness.For(tt) defer t.Close() ... }
```
func For ¶
For creates a Harness from a testing.T Callers must call Close on the Harness so that resources can be cleaned up
func (*Harness) Close ¶
func (h *Harness) Close()
Close cleans up any owned resources, and should be called in a defer block after For
func (*Harness) TempDir ¶
TempDir is a wrapper around os.MkdirTemp for tests. It automatically fails the test if we can't create a temp file, and deletes the temp directory when Close is called on the Harness
Source Files ¶
harness.go
- Version
- v1.33.0 (latest)
- Published
- Apr 23, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 3 hours ago –
Tools for package owners.