From 4be6f6a53ac9e46699164a810ed597a739300bc3 Mon Sep 17 00:00:00 2001 From: Boris Ershov Date: Wed, 13 Nov 2024 18:47:01 +0700 Subject: [PATCH] refactor(#32): Move anonymizers unit tests data to .testdata directory --- .../mysql/{ => .testdata}/mysql_test.dos.in.sql | 0 .../mysql/{ => .testdata}/mysql_test.dos.out.sql | 0 .../mysql/{ => .testdata}/mysql_test.in.sql | 0 .../mysql/{ => .testdata}/mysql_test.out.sql | 0 modules/anonymizers/mysql/mysql_test.go | 12 ++++++------ .../pgsql/{ => .testdata}/pgsql_test.dos.in.sql | 0 .../pgsql/{ => .testdata}/pgsql_test.dos.out.sql | 0 .../pgsql/{ => .testdata}/pgsql_test.in.sql | 0 .../pgsql/{ => .testdata}/pgsql_test.out.sql | 0 modules/anonymizers/pgsql/pgsql_test.go | 12 ++++++------ 10 files changed, 12 insertions(+), 12 deletions(-) rename modules/anonymizers/mysql/{ => .testdata}/mysql_test.dos.in.sql (100%) rename modules/anonymizers/mysql/{ => .testdata}/mysql_test.dos.out.sql (100%) rename modules/anonymizers/mysql/{ => .testdata}/mysql_test.in.sql (100%) rename modules/anonymizers/mysql/{ => .testdata}/mysql_test.out.sql (100%) rename modules/anonymizers/pgsql/{ => .testdata}/pgsql_test.dos.in.sql (100%) rename modules/anonymizers/pgsql/{ => .testdata}/pgsql_test.dos.out.sql (100%) rename modules/anonymizers/pgsql/{ => .testdata}/pgsql_test.in.sql (100%) rename modules/anonymizers/pgsql/{ => .testdata}/pgsql_test.out.sql (100%) diff --git a/modules/anonymizers/mysql/mysql_test.dos.in.sql b/modules/anonymizers/mysql/.testdata/mysql_test.dos.in.sql similarity index 100% rename from modules/anonymizers/mysql/mysql_test.dos.in.sql rename to modules/anonymizers/mysql/.testdata/mysql_test.dos.in.sql diff --git a/modules/anonymizers/mysql/mysql_test.dos.out.sql b/modules/anonymizers/mysql/.testdata/mysql_test.dos.out.sql similarity index 100% rename from modules/anonymizers/mysql/mysql_test.dos.out.sql rename to modules/anonymizers/mysql/.testdata/mysql_test.dos.out.sql diff --git a/modules/anonymizers/mysql/mysql_test.in.sql b/modules/anonymizers/mysql/.testdata/mysql_test.in.sql similarity index 100% rename from modules/anonymizers/mysql/mysql_test.in.sql rename to modules/anonymizers/mysql/.testdata/mysql_test.in.sql diff --git a/modules/anonymizers/mysql/mysql_test.out.sql b/modules/anonymizers/mysql/.testdata/mysql_test.out.sql similarity index 100% rename from modules/anonymizers/mysql/mysql_test.out.sql rename to modules/anonymizers/mysql/.testdata/mysql_test.out.sql diff --git a/modules/anonymizers/mysql/mysql_test.go b/modules/anonymizers/mysql/mysql_test.go index 5b96c38..8243097 100644 --- a/modules/anonymizers/mysql/mysql_test.go +++ b/modules/anonymizers/mysql/mysql_test.go @@ -14,7 +14,7 @@ func TestMySQL(t *testing.T) { var r, e bytes.Buffer - fin, err := os.Open("mysql_test.in.sql") + fin, err := os.Open(".testdata/mysql_test.in.sql") if err != nil { t.Fatal("open input SQL:", err) } @@ -63,7 +63,7 @@ func TestMySQL(t *testing.T) { t.Fatal("run MySQL:", err) } - fout, err := os.Open("mysql_test.out.sql") + fout, err := os.Open(".testdata/mysql_test.out.sql") if err != nil { t.Fatal("open output SQL:", err) } @@ -72,7 +72,7 @@ func TestMySQL(t *testing.T) { t.Fatal("read output SQL:", err) } - // os.WriteFile("mysql_test.out.sql", r.Bytes(), 0644) + // os.WriteFile(".testdata/mysql_test.out.sql", r.Bytes(), 0644) if r.String() != e.String() { t.Fatal("incorrect anonymization result") @@ -85,7 +85,7 @@ func TestMySQLDos(t *testing.T) { var r, e bytes.Buffer - fin, err := os.Open("mysql_test.dos.in.sql") + fin, err := os.Open(".testdata/mysql_test.dos.in.sql") if err != nil { t.Fatal("open input SQL:", err) } @@ -134,7 +134,7 @@ func TestMySQLDos(t *testing.T) { t.Fatal("run MySQL:", err) } - fout, err := os.Open("mysql_test.dos.out.sql") + fout, err := os.Open(".testdata/mysql_test.dos.out.sql") if err != nil { t.Fatal("open output SQL:", err) } @@ -143,7 +143,7 @@ func TestMySQLDos(t *testing.T) { t.Fatal("read output SQL:", err) } - // os.WriteFile("mysql_test.dos.out.sql", r.Bytes(), 0644) + // os.WriteFile(".testdata/mysql_test.dos.out.sql", r.Bytes(), 0644) if r.String() != e.String() { t.Fatal("incorrect anonymization result") diff --git a/modules/anonymizers/pgsql/pgsql_test.dos.in.sql b/modules/anonymizers/pgsql/.testdata/pgsql_test.dos.in.sql similarity index 100% rename from modules/anonymizers/pgsql/pgsql_test.dos.in.sql rename to modules/anonymizers/pgsql/.testdata/pgsql_test.dos.in.sql diff --git a/modules/anonymizers/pgsql/pgsql_test.dos.out.sql b/modules/anonymizers/pgsql/.testdata/pgsql_test.dos.out.sql similarity index 100% rename from modules/anonymizers/pgsql/pgsql_test.dos.out.sql rename to modules/anonymizers/pgsql/.testdata/pgsql_test.dos.out.sql diff --git a/modules/anonymizers/pgsql/pgsql_test.in.sql b/modules/anonymizers/pgsql/.testdata/pgsql_test.in.sql similarity index 100% rename from modules/anonymizers/pgsql/pgsql_test.in.sql rename to modules/anonymizers/pgsql/.testdata/pgsql_test.in.sql diff --git a/modules/anonymizers/pgsql/pgsql_test.out.sql b/modules/anonymizers/pgsql/.testdata/pgsql_test.out.sql similarity index 100% rename from modules/anonymizers/pgsql/pgsql_test.out.sql rename to modules/anonymizers/pgsql/.testdata/pgsql_test.out.sql diff --git a/modules/anonymizers/pgsql/pgsql_test.go b/modules/anonymizers/pgsql/pgsql_test.go index 838782e..569488c 100644 --- a/modules/anonymizers/pgsql/pgsql_test.go +++ b/modules/anonymizers/pgsql/pgsql_test.go @@ -14,7 +14,7 @@ func TestPgSQL(t *testing.T) { var r, e bytes.Buffer - fin, err := os.Open("pgsql_test.in.sql") + fin, err := os.Open(".testdata/pgsql_test.in.sql") if err != nil { t.Fatal("open input SQL:", err) } @@ -63,7 +63,7 @@ func TestPgSQL(t *testing.T) { t.Fatal("run PgSQL:", err) } - fout, err := os.Open("pgsql_test.out.sql") + fout, err := os.Open(".testdata/pgsql_test.out.sql") if err != nil { t.Fatal("open output SQL:", err) } @@ -72,7 +72,7 @@ func TestPgSQL(t *testing.T) { t.Fatal("read output SQL:", err) } - // os.WriteFile("pgsql_test.out.sql", r.Bytes(), 0644) + // os.WriteFile(".testdata/pgsql_test.out.sql", r.Bytes(), 0644) if r.String() != e.String() { t.Fatal("incorrect anonymization result") @@ -85,7 +85,7 @@ func TestPgSQLDos(t *testing.T) { var r, e bytes.Buffer - fin, err := os.Open("pgsql_test.dos.in.sql") + fin, err := os.Open(".testdata/pgsql_test.dos.in.sql") if err != nil { t.Fatal("open input SQL:", err) } @@ -134,7 +134,7 @@ func TestPgSQLDos(t *testing.T) { t.Fatal("run PgSQL:", err) } - fout, err := os.Open("pgsql_test.dos.out.sql") + fout, err := os.Open(".testdata/pgsql_test.dos.out.sql") if err != nil { t.Fatal("open output SQL:", err) } @@ -143,7 +143,7 @@ func TestPgSQLDos(t *testing.T) { t.Fatal("read output SQL:", err) } - // os.WriteFile("pgsql_test.dos.out.sql", r.Bytes(), 0644) + // os.WriteFile(".testdata/pgsql_test.dos.out.sql", r.Bytes(), 0644) if r.String() != e.String() { t.Fatal("incorrect anonymization result")