- Created a new Go module named 'teleport' for secure port forwarding. - Added essential files including .gitignore, LICENSE, and README.md with project details. - Implemented configuration management with YAML support in config package. - Developed core client and server functionalities for handling port forwarding. - Introduced DNS server capabilities and integrated logging with sanitization. - Established rate limiting and metrics tracking for performance monitoring. - Included comprehensive tests for core components and functionalities. - Set up CI workflows for automated testing and release management using Gitea actions.
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"teleport/pkg/logger"
|
|
)
|
|
|
|
// TestSimpleQuickTest runs a very simple test to demonstrate parallel execution
|
|
func TestSimpleQuickTest1(t *testing.T) {
|
|
runSimpleTest(t, 1)
|
|
}
|
|
|
|
// TestSimpleQuickTest2 runs a very simple test to demonstrate parallel execution
|
|
func TestSimpleQuickTest2(t *testing.T) {
|
|
runSimpleTest(t, 2)
|
|
}
|
|
|
|
// TestSimpleQuickTest3 runs a very simple test to demonstrate parallel execution
|
|
func TestSimpleQuickTest3(t *testing.T) {
|
|
runSimpleTest(t, 3)
|
|
}
|
|
|
|
// runSimpleTest runs a simple test that demonstrates the optimization
|
|
func runSimpleTest(t *testing.T, testNum int) {
|
|
t.Parallel() // Run in parallel with other tests
|
|
|
|
// Initialize logger for testing
|
|
logConfig := logger.Config{
|
|
Level: "warn", // Reduce log noise
|
|
Format: "text",
|
|
File: "",
|
|
}
|
|
if err := logger.Init(logConfig); err != nil {
|
|
t.Fatalf("Failed to initialize logger: %v", err)
|
|
}
|
|
|
|
// Simulate some work
|
|
t.Logf("Test %d: Starting simple test", testNum)
|
|
|
|
// Simulate network operations with sleep
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
|
// Simulate some computation
|
|
result := 0
|
|
for i := 0; i < 1000; i++ {
|
|
result += i
|
|
}
|
|
|
|
// Validate result
|
|
expected := 499500 // Sum of 0 to 999
|
|
if result != expected {
|
|
t.Errorf("Test %d: Expected %d, got %d", testNum, expected, result)
|
|
}
|
|
|
|
t.Logf("Test %d: Completed successfully (result: %d)", testNum, result)
|
|
}
|