Some checks failed
go: build dev binaries / cleanup (push) Successful in 4s
Codespell / Check for spelling errors (push) Failing after 3s
docker: build dev containers / build-rust-binaries (amd64, x86_64-unknown-linux-musl) (push) Failing after 3s
docker: build dev containers / build-dev-containers (push) Has been skipped
docker: build dev containers / build-rust-binaries (arm64, true, aarch64-unknown-linux-musl) (push) Failing after 3s
End to End / FUSE Mount (push) Failing after 2s
EC Integration Tests / EC Integration Tests (push) Failing after 30s
FUSE DLM Integration Tests / FUSE DLM Integration Tests (push) Failing after 3s
FUSE Volume Server Failover Tests / FUSE Volume Server Failover (push) Failing after 3s
FUSE Integration Tests / FUSE Integration Testing (push) Failing after 2s
FUSE P2P Peer Chunk Sharing Integration Tests / FUSE P2P Peer Chunk Sharing (push) Failing after 3s
go: build binary / Go Vet (push) Failing after 2s
go: build binary / Go Vet 32-bit (push) Failing after 3s
go: build binary / Build (push) Failing after 4s
go: build binary / Build cross-platform (freebsd/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/amd64) (push) Failing after 3s
go: build binary / Build cross-platform (darwin/arm64) (push) Failing after 3s
go: build binary / Build cross-platform (windows/arm64) (push) Failing after 3s
go: build binary / Test (push) Failing after 2s
go: build binary / Test 32-bit (push) Failing after 3s
helm: lint and test charts / lint-test (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (11) (push) Failing after 3s
Java Client Integration Tests / Java Integration Tests (17) (push) Failing after 3s
go: build dev binaries / build_dev_linux_windows (amd64, linux) (push) Failing after 2s
go: build dev binaries / build_dev_linux_windows (amd64, windows) (push) Failing after 3s
go: build dev binaries / build_dev_darwin (amd64, darwin) (push) Has been skipped
go: build dev binaries / build_dev_darwin (arm64, darwin) (push) Has been skipped
Java Client Unit Tests / Java Unit Tests (11) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (17) (push) Failing after 2s
Java Client Unit Tests / Java Unit Tests (21) (push) Failing after 3s
Java Client Unit Tests / Java Unit Tests (8) (push) Failing after 3s
Kafka Quick Test (Load Test with Schema Registry) / Kafka Client Load Test (Quick) (push) Failing after 3s
Kafka Gateway Tests / Kafka Unit Tests (unit-tests-1) (push) Failing after 11s
Kafka Gateway Tests / Kafka Integration Tests (Critical) (integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka End-to-End Tests (with SMQ) (e2e-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Consumer Group Tests (Highly Isolated) (consumer-group-1) (push) Failing after 2s
Kafka Gateway Tests / Kafka Client Compatibility (with SMQ) (client-compat-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka SMQ Integration Tests (Full Stack) (smq-integration-1) (push) Failing after 3s
Kafka Gateway Tests / Kafka Protocol Tests (Isolated) (protocol-1) (push) Failing after 3s
KMS Tests / KMS Provider Integration Tests (push) Failing after 2s
KMS Tests / S3 KMS End-to-End Tests (push) Failing after 3s
Master Cold Start Tests / Master Cold Start Tests (push) Failing after 4s
Metadata Subscribe Integration Tests / Metadata Subscribe Integration Tests (push) Failing after 3s
Multi-Master Tests / Multi-Master Failover Tests (push) Failing after 3s
Performance / CPU and Heap Profile (push) Failing after 2s
Performance / S3 Read/Write Benchmark (rust volume) (push) Failing after 3s
pjdfstest POSIX Compliance / pjdfstest (push) Failing after 2s
Plugin Worker Integration Tests / Plugin Worker: erasure_coding (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: vacuum (push) Failing after 3s
Rust Volume Server Tests / Rust Integration Tests (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 1) (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 1) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 2) (push) Failing after 3s
Rust Volume Server Tests / Go Tests with Rust Volume (grpc - Shard 3) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Distributed Tests (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Performance Tests (push) Failing after 3s
Performance / Throughput Benchmark (go volume) (push) Failing after 3s
Performance / Throughput Benchmark (rust volume) (push) Failing after 2s
Performance / S3 Read/Write Benchmark (go volume) (push) Failing after 3s
Plugin Worker Integration Tests / Plugin Worker: volume_balance (push) Failing after 3s
PostgreSQL Gateway Tests / PostgreSQL Basic Tests (push) Failing after 3s
Rust Volume Server Tests / Rust Unit Tests (push) Failing after 2s
Rust Volume Server Tests / Go Tests with Rust Volume (http - Shard 3) (push) Failing after 3s
Rust Plugin Worker Tests / Rust Plugin Worker Build and Unit Tests (push) Failing after 3s
rust: build dev volume server binaries / cleanup (push) Successful in 3s
S3 ETag and ACL Tests / S3 ETag + ACL Integration Tests (push) Failing after 3s
S3 IAM Integration Tests / IAM Unit Tests (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (advanced) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (basic) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (group) (push) Failing after 3s
S3 IAM Integration Tests / S3 IAM Integration Tests (policy-enforcement) (push) Failing after 2s
S3 IAM Integration Tests / S3 IAM Integration Tests (sts) (push) Failing after 4s
S3 Keycloak Integration Tests / S3 Keycloak Integration Tests (push) Failing after 3s
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.11) (push) Failing after 3s
S3 PyArrow Parquet Tests / Go Unit Tests (Implicit Directory) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.12) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-amd64, x86_64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-darwin (darwin-arm64, aarch64-apple-darwin) (push) Has been cancelled
rust: build dev volume server binaries / build-rust-volume-dev-linux (linux-amd64, x86_64-unknown-linux-gnu) (push) Has been cancelled
S3 PyArrow Parquet Tests / PyArrow Parquet Tests (Python 3.9) (push) Has been cancelled
S3 Proxy Signature Tests / S3 Proxy Signature Verification Tests (push) Has been cancelled
S3 SDK V2 Route Disambiguation Tests / S3 SDK V2 Routing Tests (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (quick) (push) Has been cancelled
S3 SSE Tests / S3 SSE Compatibility Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Metadata Persistence Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Copy Operations Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Multipart Upload Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Performance Test (push) Has been cancelled
S3 SSE Tests / S3 Volume Encryption Test (push) Has been cancelled
S3 SSE Tests / S3 SSE Integration Tests (comprehensive) (push) Has been cancelled
Spark Integration Tests / Spark Integration Tests (push) Failing after 2s
Telemetry Integration Tests / telemetry-integration-test (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 1) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 1) (push) Failing after 3s
Ceph S3 tests / Basic S3 tests (KV store) (push) Has been cancelled
Ceph S3 tests / S3 Versioning & Object Lock tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Unit Tests (push) Failing after 3s
Ceph S3 tests / S3 CORS tests (push) Has been cancelled
Ceph S3 tests / SeaweedFS Custom S3 Copy tests (push) Has been cancelled
Ceph S3 tests / Basic S3 tests (SQL store) (push) Has been cancelled
test s3 over https using aws-cli / awscli-tests (push) Has been cancelled
TLS Rotation Integration Tests / TLS Rotation Integration Tests (push) Has been cancelled
Vacuum Integration Tests / Vacuum Integration Tests (push) Has been cancelled
S3 Policy Integration Tests / S3 Policy Variables Integration Tests (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (advanced-policy) (push) Failing after 3s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (basic-policy) (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Enforcement Integration Tests (contextual-policy) (push) Failing after 4s
S3 Policy Integration Tests / Trusted Proxy Detection Tests (push) Failing after 2s
S3 Policy Integration Tests / S3 Policy Shell Integration Tests (push) Failing after 3s
Samba on FUSE Integration / samba-integration (push) Failing after 2s
SFTP Integration Tests / SFTP Integration Testing (push) Failing after 3s
terraform: validate and test modules / fmt, validate, plan-level tests (push) Failing after 3s
terraform: validate and test modules / local cluster smoke test (real weed) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 3) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (grpc - Shard 2) (push) Failing after 3s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 2) (push) Failing after 2s
Volume Server Integration Tests / Volume Server Integration Tests (http - Shard 3) (push) Failing after 5s
mount: windows conformance / WinFsp conformance (push) Has been cancelled
mount: windows / Mount on Windows (push) Has been cancelled
295 lines
9.4 KiB
Go
295 lines
9.4 KiB
Go
package remote_cache
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestRemoteCacheBasicCommand tests caching files from remote using command
|
|
func TestRemoteCacheBasicCommand(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
testKey := fmt.Sprintf("cache-basic-%d.txt", time.Now().UnixNano())
|
|
testData := createTestFile(t, testKey, 1024)
|
|
|
|
// Uncache first to push to remote
|
|
t.Log("Uncaching file to remote...")
|
|
uncacheLocal(t, testKey)
|
|
|
|
// Now cache it back using remote.cache command
|
|
t.Log("Caching file from remote using command...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache command failed")
|
|
t.Logf("Cache output: %s", output)
|
|
|
|
// Verify file is still readable
|
|
verifyFileContent(t, testKey, testData)
|
|
}
|
|
|
|
// TestRemoteCacheWithInclude tests caching only matching files
|
|
func TestRemoteCacheWithInclude(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create multiple files with different extensions
|
|
pdfFile := fmt.Sprintf("doc-%d.pdf", time.Now().UnixNano())
|
|
txtFile := fmt.Sprintf("doc-%d.txt", time.Now().UnixNano())
|
|
|
|
pdfData := createTestFile(t, pdfFile, 512)
|
|
txtData := createTestFile(t, txtFile, 512)
|
|
|
|
// Uncache both
|
|
uncacheLocal(t, "*.pdf")
|
|
uncacheLocal(t, "*.txt")
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
// Cache only PDF files
|
|
t.Log("Caching only PDF files...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s -include=*.pdf", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache with include failed")
|
|
t.Logf("Cache output: %s", output)
|
|
|
|
// Both files should still be readable
|
|
verifyFileContent(t, pdfFile, pdfData)
|
|
verifyFileContent(t, txtFile, txtData)
|
|
}
|
|
|
|
// TestRemoteCacheWithExclude tests caching excluding pattern
|
|
func TestRemoteCacheWithExclude(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create test files
|
|
keepFile := fmt.Sprintf("keep-%d.txt", time.Now().UnixNano())
|
|
tmpFile := fmt.Sprintf("temp-%d.tmp", time.Now().UnixNano())
|
|
|
|
keepData := createTestFile(t, keepFile, 512)
|
|
tmpData := createTestFile(t, tmpFile, 512)
|
|
|
|
// Uncache both
|
|
uncacheLocal(t, "keep-*")
|
|
uncacheLocal(t, "temp-*")
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
// Cache excluding .tmp files
|
|
t.Log("Caching excluding .tmp files...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s -exclude=*.tmp", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache with exclude failed")
|
|
t.Logf("Cache output: %s", output)
|
|
|
|
// Both should still be readable
|
|
verifyFileContent(t, keepFile, keepData)
|
|
verifyFileContent(t, tmpFile, tmpData)
|
|
}
|
|
|
|
// TestRemoteCacheMinSize tests caching files larger than threshold
|
|
func TestRemoteCacheMinSize(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create files of different sizes
|
|
smallFile := fmt.Sprintf("small-%d.bin", time.Now().UnixNano())
|
|
largeFile := fmt.Sprintf("large-%d.bin", time.Now().UnixNano())
|
|
|
|
smallData := createTestFile(t, smallFile, 100) // 100 bytes
|
|
largeData := createTestFile(t, largeFile, 10000) // 10KB
|
|
|
|
// Uncache both
|
|
uncacheLocal(t, "small-*")
|
|
uncacheLocal(t, "large-*")
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
// Cache only files larger than 1KB
|
|
t.Log("Caching files larger than 1KB...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s -minSize=1024", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache with minSize failed")
|
|
t.Logf("Cache output: %s", output)
|
|
|
|
// Both should still be readable
|
|
verifyFileContent(t, smallFile, smallData)
|
|
verifyFileContent(t, largeFile, largeData)
|
|
}
|
|
|
|
// TestRemoteCacheMaxSize tests caching files smaller than threshold
|
|
func TestRemoteCacheMaxSize(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create files of different sizes
|
|
smallFile := fmt.Sprintf("tiny-%d.bin", time.Now().UnixNano())
|
|
mediumFile := fmt.Sprintf("medium-%d.bin", time.Now().UnixNano())
|
|
|
|
smallData := createTestFile(t, smallFile, 500) // 500 bytes
|
|
mediumData := createTestFile(t, mediumFile, 5000) // 5KB
|
|
|
|
// Uncache both
|
|
uncacheLocal(t, "tiny-*")
|
|
uncacheLocal(t, "medium-*")
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
// Cache only files smaller than 2KB
|
|
t.Log("Caching files smaller than 2KB...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s -maxSize=2048", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache with maxSize failed")
|
|
t.Logf("Cache output: %s", output)
|
|
|
|
// Both should still be readable
|
|
verifyFileContent(t, smallFile, smallData)
|
|
verifyFileContent(t, mediumFile, mediumData)
|
|
}
|
|
|
|
// TestRemoteCacheCombinedFilters tests multiple filters together
|
|
func TestRemoteCacheCombinedFilters(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create test files
|
|
matchFile := fmt.Sprintf("data-%d.dat", time.Now().UnixNano())
|
|
noMatchFile := fmt.Sprintf("skip-%d.txt", time.Now().UnixNano())
|
|
|
|
matchData := createTestFile(t, matchFile, 2000) // 2KB .dat file
|
|
noMatchData := createTestFile(t, noMatchFile, 100) // 100 byte .txt file
|
|
|
|
// Uncache both
|
|
uncacheLocal(t, "data-*")
|
|
uncacheLocal(t, "skip-*")
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
// Cache .dat files larger than 1KB
|
|
t.Log("Caching .dat files larger than 1KB...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s -include=*.dat -minSize=1024", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache with combined filters failed")
|
|
t.Logf("Cache output: %s", output)
|
|
|
|
// Both should still be readable
|
|
verifyFileContent(t, matchFile, matchData)
|
|
verifyFileContent(t, noMatchFile, noMatchData)
|
|
}
|
|
|
|
// TestRemoteCacheDryRun tests preview without actual caching
|
|
func TestRemoteCacheDryRun(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
testKey := fmt.Sprintf("dryrun-%d.txt", time.Now().UnixNano())
|
|
createTestFile(t, testKey, 1024)
|
|
|
|
// Uncache
|
|
uncacheLocal(t, testKey)
|
|
time.Sleep(500 * time.Millisecond)
|
|
|
|
// Run cache in dry-run mode
|
|
t.Log("Running cache in dry-run mode...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s -dryRun=true", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache dry-run failed")
|
|
t.Logf("Dry-run output: %s", output)
|
|
|
|
// File should still be readable (caching happens on-demand anyway)
|
|
getFromPrimary(t, testKey)
|
|
}
|
|
|
|
// TestRemoteUncacheBasic tests uncaching files (removing local chunks)
|
|
func TestRemoteUncacheBasic(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
testKey := fmt.Sprintf("uncache-basic-%d.txt", time.Now().UnixNano())
|
|
testData := createTestFile(t, testKey, 2048)
|
|
|
|
// Verify file exists
|
|
verifyFileContent(t, testKey, testData)
|
|
|
|
// Uncache it
|
|
t.Log("Uncaching file...")
|
|
cmd := fmt.Sprintf("remote.uncache -dir=/buckets/%s -include=%s", testBucket, testKey)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.uncache failed")
|
|
t.Logf("Uncache output: %s", output)
|
|
|
|
// File should still be readable (will be fetched from remote)
|
|
verifyFileContent(t, testKey, testData)
|
|
}
|
|
|
|
// TestRemoteUncacheWithFilters tests uncaching with include/exclude patterns
|
|
func TestRemoteUncacheWithFilters(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create multiple files
|
|
file1 := fmt.Sprintf("uncache-filter1-%d.log", time.Now().UnixNano())
|
|
file2 := fmt.Sprintf("uncache-filter2-%d.txt", time.Now().UnixNano())
|
|
|
|
data1 := createTestFile(t, file1, 1024)
|
|
data2 := createTestFile(t, file2, 1024)
|
|
|
|
// Uncache only .log files
|
|
t.Log("Uncaching only .log files...")
|
|
cmd := fmt.Sprintf("remote.uncache -dir=/buckets/%s -include=*.log", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.uncache with filter failed")
|
|
t.Logf("Uncache output: %s", output)
|
|
|
|
// Both should still be readable
|
|
verifyFileContent(t, file1, data1)
|
|
verifyFileContent(t, file2, data2)
|
|
}
|
|
|
|
// TestRemoteUncacheMinSize tests uncaching files based on size
|
|
func TestRemoteUncacheMinSize(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create files of different sizes
|
|
smallFile := fmt.Sprintf("uncache-small-%d.bin", time.Now().UnixNano())
|
|
largeFile := fmt.Sprintf("uncache-large-%d.bin", time.Now().UnixNano())
|
|
|
|
smallData := createTestFile(t, smallFile, 500)
|
|
largeData := createTestFile(t, largeFile, 5000)
|
|
|
|
// Uncache only files larger than 2KB
|
|
t.Log("Uncaching files larger than 2KB...")
|
|
cmd := fmt.Sprintf("remote.uncache -dir=/buckets/%s -minSize=2048", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.uncache with minSize failed")
|
|
t.Logf("Uncache output: %s", output)
|
|
|
|
// Both should still be readable
|
|
verifyFileContent(t, smallFile, smallData)
|
|
verifyFileContent(t, largeFile, largeData)
|
|
}
|
|
|
|
// TestRemoteCacheConcurrency tests cache with different concurrency levels
|
|
func TestRemoteCacheConcurrency(t *testing.T) {
|
|
checkServersRunning(t)
|
|
|
|
// Create multiple files
|
|
var files []string
|
|
var dataMap = make(map[string][]byte)
|
|
|
|
for i := 0; i < 5; i++ {
|
|
key := fmt.Sprintf("concurrent-%d-%d.bin", time.Now().UnixNano(), i)
|
|
data := createTestFile(t, key, 1024)
|
|
files = append(files, key)
|
|
dataMap[key] = data
|
|
}
|
|
|
|
// Uncache all
|
|
for _, file := range files {
|
|
uncacheLocal(t, file)
|
|
}
|
|
time.Sleep(1 * time.Second)
|
|
|
|
// Cache with high concurrency
|
|
t.Log("Caching with concurrency=8...")
|
|
cmd := fmt.Sprintf("remote.cache -dir=/buckets/%s -concurrent=8", testBucket)
|
|
output, err := runWeedShellWithOutput(t, cmd)
|
|
require.NoError(t, err, "remote.cache with concurrency failed")
|
|
t.Logf("Cache output: %s", output)
|
|
|
|
// Verify all files are readable
|
|
for _, file := range files {
|
|
verifyFileContent(t, file, dataMap[file])
|
|
}
|
|
}
|