Переведите приём и чтение вложений на асинхронный контракт
This commit is contained in:
@@ -3,6 +3,7 @@ package config_test
|
||||
import (
|
||||
"messenger/internal/platform/config"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestS3LimitsAndSecretFiles(t *testing.T) {
|
||||
@@ -25,3 +26,21 @@ func TestS3LimitsAndSecretFiles(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
func TestS3RejectsInvalidStagingRetention(t *testing.T) {
|
||||
values := map[string]string{"S3_ACCESS_KEY_ID_FILE": secretFile(t, "access\n"), "S3_SECRET_ACCESS_KEY_FILE": secretFile(t, "private\n")}
|
||||
cfg, err := config.LoadS3(env(values))
|
||||
if err != nil || cfg.StagingRetention != 24*time.Hour {
|
||||
t.Fatalf("default retention %v %v", cfg.StagingRetention, err)
|
||||
}
|
||||
values["STAGING_RETENTION_SECONDS"] = "7200"
|
||||
cfg, err = config.LoadS3(env(values))
|
||||
if err != nil || cfg.StagingRetention != 2*time.Hour {
|
||||
t.Fatalf("custom retention %v %v", cfg.StagingRetention, err)
|
||||
}
|
||||
for _, value := range []string{"0", "-1", "abc", "9223372036854775807"} {
|
||||
values["STAGING_RETENTION_SECONDS"] = value
|
||||
if _, err := config.LoadS3(env(values)); err == nil {
|
||||
t.Errorf("accepted invalid retention %s", value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user