Skip to content

Commit 2cbfc47

Browse files
committed
Add doc.go with package documentation for godoc
1 parent f3b522c commit 2cbfc47

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

doc.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Package testutils provides a collection of utilities for testing Go applications, including stdout/stderr capture,
2+
// file handling, HTTP test helpers, and test containers.
3+
//
4+
// It consists of several main components:
5+
//
6+
// Capture Utilities:
7+
// - CaptureStdout, CaptureStderr, CaptureStdoutAndStderr: Functions to capture output from standard streams
8+
// during test execution. These are useful for testing functions that write directly to stdout/stderr.
9+
// Note: These functions are not thread-safe for parallel tests.
10+
//
11+
// File Utilities:
12+
// - WriteTestFile: Creates a temporary file with specified content for testing purposes,
13+
// with automatic cleanup after the test completes.
14+
//
15+
// HTTP Utilities:
16+
// - MockHTTPServer: Creates a test HTTP server with the provided handler
17+
// - HTTPRequestCaptor: Captures and records HTTP requests for later inspection
18+
//
19+
// Test Containers:
20+
// The 'containers' subpackage provides Docker containers for integration testing:
21+
// - SSHTestContainer: SSH server container with file operation support (upload, download, list, delete)
22+
// - FTPTestContainer: FTP server container with file operation support
23+
// - PostgresTestContainer: PostgreSQL database container with automatic DB creation
24+
// - MySQLTestContainer: MySQL database container with automatic DB creation
25+
// - MongoTestContainer: MongoDB container with support for multiple versions
26+
// - LocalstackTestContainer: LocalStack container with S3 service for AWS testing
27+
//
28+
// All container implementations support a common pattern:
29+
// - Container creation with NewXXXTestContainer
30+
// - Automatic port mapping and connection configuration
31+
// - Graceful shutdown with the Close method
32+
// - File operations where applicable (SaveFile, GetFile, ListFiles, DeleteFile)
33+
//
34+
// These utilities help simplify test setup, improve test reliability, and reduce
35+
// boilerplate code in test suites, especially for integration tests.
36+
37+
package testutils

0 commit comments

Comments
 (0)