Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

591 B
Raw Blame
package storage

import (
	"errors"
	"testing"
)

func TestRemoteSuperBlockLogOnlyOnError(t *testing.T) {
	var logged int
	old := logRemoteSuperBlockFault
	logRemoteSuperBlockFault = func(string, ...interface{}) { logged++ }
	defer func() { logRemoteSuperBlockFault = old }()
	logRemoteSuperBlockErr(219, nil)
	if logged != 0 {
		t.Fatalf("a nil error was logged at ERROR (the \"readSuperBlock remote volume 219: <nil>\" line)")
	}
	logRemoteSuperBlockErr(219, errors.New("timeout")) // positive control
	if logged != 1 {
		t.Fatalf("a real error must still be logged, got %d", logged)
	}
}