Доработайте публикацию и сверку вложений по итогам ревью

This commit is contained in:
2026-11-18 11:43:27 +03:00
parent 1f06d9f4ab
commit 80c4a56200
27 changed files with 605 additions and 275 deletions
+35
View File
@@ -0,0 +1,35 @@
package main
import (
"bytes"
"context"
"os"
"path/filepath"
"strings"
"testing"
)
func TestReconcileDoesNotValidateUnusedLogging(t *testing.T) {
for key, value := range map[string]string{
"DATABASE_URL_FILE": "postgres://test:test@127.0.0.1:5432/messenger?sslmode=disable",
"S3_ACCESS_KEY_ID_FILE": "test-access",
"S3_SECRET_ACCESS_KEY_FILE": "test-secret",
} {
path := filepath.Join(t.TempDir(), key)
if err := os.WriteFile(path, []byte(value), 0600); err != nil {
t.Fatal(err)
}
t.Setenv(key, path)
}
t.Setenv("S3_ENDPOINT", "http://127.0.0.1:8333")
t.Setenv("S3_REGION", "us-east-1")
t.Setenv("S3_BUCKET", "attachments")
t.Setenv("APP_LOG_LEVEL", "not-a-log-level")
ctx, cancel := context.WithCancel(context.Background())
cancel() // Stop before dialing: only configuration relevant to this CLI is checked.
var out, errOut bytes.Buffer
code := run(ctx, nil, &out, &errOut)
if code != 1 || strings.Contains(errOut.String(), "APP_LOG_LEVEL") {
t.Fatalf("unused logging prevented the database operation: code=%d error=%s", code, errOut.String())
}
}