style: инициализировать слайсы через make

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-08-09 00:32:47 +03:00
parent 3950dd94ee
commit 174b5f9048
7 changed files with 69 additions and 67 deletions
+14 -27
View File
@@ -44,10 +44,8 @@ func mockCommandContext(
}
func TestDump_Success(t *testing.T) {
wantArgs := []string{
"--format=custom",
"--exclude-table=e2e_one_time_keys_json",
}
wantArgs := make([]string, 0, 2)
wantArgs = append(wantArgs, "--format=custom", "--exclude-table=e2e_one_time_keys_json")
adapter := &adapter{
commandContext: mockCommandContext(
@@ -78,10 +76,8 @@ func TestDump_Success(t *testing.T) {
func TestDump_WaitAfterStdoutEOF(t *testing.T) {
// This test verifies that after io.Copy returns (stdout EOF),
// cmd.Wait() is called and the exit code is verified before returning.
wantArgs := []string{
"--format=custom",
"--exclude-table=e2e_one_time_keys_json",
}
wantArgs := make([]string, 0, 2)
wantArgs = append(wantArgs, "--format=custom", "--exclude-table=e2e_one_time_keys_json")
adapter := &adapter{
commandContext: mockCommandContext(
@@ -110,10 +106,8 @@ func TestDump_WaitAfterStdoutEOF(t *testing.T) {
}
func TestDump_NonZeroExitCode(t *testing.T) {
wantArgs := []string{
"--format=custom",
"--exclude-table=e2e_one_time_keys_json",
}
wantArgs := make([]string, 0, 2)
wantArgs = append(wantArgs, "--format=custom", "--exclude-table=e2e_one_time_keys_json")
adapter := &adapter{
commandContext: mockCommandContext(
@@ -200,10 +194,8 @@ func TestDump_ContextCancellation(t *testing.T) {
}
func TestDump_DefaultExcludeTables(t *testing.T) {
wantArgs := []string{
"--format=custom",
"--exclude-table=e2e_one_time_keys_json",
}
wantArgs := make([]string, 0, 2)
wantArgs = append(wantArgs, "--format=custom", "--exclude-table=e2e_one_time_keys_json")
adapter := &adapter{
commandContext: mockCommandContext(
@@ -227,11 +219,8 @@ func TestDump_DefaultExcludeTables(t *testing.T) {
}
func TestDump_CustomExcludeTables(t *testing.T) {
wantArgs := []string{
"--format=custom",
"--exclude-table=table_a",
"--exclude-table=table_b",
}
wantArgs := make([]string, 0, 3)
wantArgs = append(wantArgs, "--format=custom", "--exclude-table=table_a", "--exclude-table=table_b")
adapter := &adapter{
commandContext: mockCommandContext(
@@ -288,12 +277,10 @@ func TestDump_EnvVars(t *testing.T) {
t.Errorf("PGPASSWORD must not be passed to pg_dump subprocess")
}
wantEnvVars := []string{
"PGHOST=myhost",
"PGPORT=5433",
"PGUSER=myuser",
"PGDATABASE=mydb",
}
wantEnvVars := make([]string, 0, 4)
wantEnvVars = append(wantEnvVars, "PGHOST=myhost", "PGPORT=5433", "PGUSER=myuser", "PGDATABASE=mydb")
for _, wantEnv := range wantEnvVars {
if !strings.Contains(envStr, wantEnv) {
t.Errorf("env missing %q", wantEnv)