You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chrislu 5ed6db9dfe security: use proper SSH host key verification in tests 1 day ago
..
testdata test: add SFTP integration tests 1 day ago
Makefile test: add SFTP integration tests 1 day ago
README.md test: add SFTP integration tests 1 day ago
basic_test.go test: add SFTP integration tests 1 day ago
framework.go security: use proper SSH host key verification in tests 1 day ago
go.mod security: update golang.org/x/crypto to v0.45.0 1 day ago
go.sum security: update golang.org/x/crypto to v0.45.0 1 day ago

README.md

SeaweedFS SFTP Integration Tests

This directory contains integration tests for the SeaweedFS SFTP server.

Prerequisites

  1. Build the SeaweedFS binary:

    cd ../../weed
    go build -o weed .
    
  2. Ensure ssh-keygen is available (for generating test SSH host keys)

Running Tests

Run all tests

make test

Run tests with verbose output

make test-verbose

Run a specific test

go test -v -run TestHomeDirPathTranslation

Skip long-running tests

go test -short ./...

Test Structure

  • framework.go - Test framework that starts SeaweedFS cluster with SFTP
  • basic_test.go - Basic SFTP operation tests including:
    • HomeDir path translation (fixes issue #7470)
    • File upload/download
    • Directory operations
    • Large file handling
    • Edge cases

Test Configuration

Tests use testdata/userstore.json which defines test users:

Username Password HomeDir Permissions
admin adminpassword / Full access
testuser testuserpassword /sftp/testuser Full access to home
readonly readonlypassword /public Read-only

Key Tests

TestHomeDirPathTranslation

Tests the fix for issue #7470 where users with a non-root HomeDir (e.g., /sftp/testuser) could not upload files to / because the path wasn't being translated to their home directory.

The test verifies:

  • Uploading to / correctly maps to the user's HomeDir
  • Creating directories at / works
  • Listing / shows the user's home directory contents
  • All path operations respect the HomeDir translation

Debugging

To debug test failures:

  1. Enable verbose output:

    go test -v -run TestName
    
  2. Keep test artifacts (don't cleanup):

    config := DefaultTestConfig()
    config.SkipCleanup = true
    
  3. Enable debug logging:

    config := DefaultTestConfig()
    config.EnableDebug = true