Files
forge/pkg/archiver/archiver_test.go
zhaoyupeng da6a846550 feat: 许多变化
1. make apps 逻辑大变更, vendor 成标准传入 args
  2. nginx -> app-helper
2026-01-12 20:01:45 +08:00

48 lines
926 B
Go

package archiver
import (
"context"
"testing"
"yizhisec.com/hsv2/forge/pkg/logger"
)
func TestDownloadAndExtract(t *testing.T) {
logger.SetLogLevel(logger.LogLevelDebug)
ctx := context.Background()
// Example: download and extract a tar.gz file
err := DownloadAndExtract(
ctx,
"https://example.com/archive.tar.gz",
"/tmp/test-extract",
WithInsecureSkipVerify(),
)
if err != nil {
t.Logf("Expected error for test URL: %v", err)
}
}
func TestDownloadAndExtractWithProgress(t *testing.T) {
logger.SetLogLevel(logger.LogLevelDebug)
ctx := context.Background()
// Example: with progress callback
err := DownloadAndExtract(
ctx,
"https://example.com/archive.tar",
"/tmp/test-extract",
WithInsecureSkipVerify(),
WithProgress(func(filename string, index int, total int) {
t.Logf("Extracting: %s", filename)
}),
)
if err != nil {
t.Logf("Expected error for test URL: %v", err)
}
}