(t *testing.T)
| 82 | ) |
| 83 | |
| 84 | func TestSensitiveData(t *testing.T) { |
| 85 | const ( |
| 86 | databaseName = "sensitive_data" |
| 87 | tableName = "tech_book" |
| 88 | createTable = ` |
| 89 | CREATE TABLE tech_book( |
| 90 | id int primary key, |
| 91 | name varchar(220), |
| 92 | author varchar(220) |
| 93 | ); |
| 94 | ` |
| 95 | insertData = ` |
| 96 | INSERT INTO tech_book VALUES |
| 97 | (1, 'bytebase', 'bber'), |
| 98 | (2, 'PostgreSQL 14 Internals', 'Egor Rogov'), |
| 99 | (3, 'Designing Data-Intensive Applications', 'Martin Kleppmann'); |
| 100 | ` |
| 101 | queryTable = `SELECT * FROM tech_book` |
| 102 | ) |
| 103 | t.Parallel() |
| 104 | a := require.New(t) |
| 105 | ctx := context.Background() |
| 106 | ctl := &controller{} |
| 107 | ctx, err := ctl.StartServerWithExternalPg(ctx) |
| 108 | a.NoError(err) |
| 109 | defer ctl.Close(ctx) |
| 110 | |
| 111 | _, err = ctl.settingServiceClient.UpdateSetting(ctx, connect.NewRequest(&v1pb.UpdateSettingRequest{ |
| 112 | Setting: &v1pb.Setting{ |
| 113 | Name: "settings/" + v1pb.Setting_SEMANTIC_TYPES.String(), |
| 114 | Value: &v1pb.SettingValue{ |
| 115 | Value: &v1pb.SettingValue_SemanticType{ |
| 116 | SemanticType: &v1pb.SemanticTypeSetting{ |
| 117 | Types: []*v1pb.SemanticTypeSetting_SemanticType{ |
| 118 | { |
| 119 | Id: "default", |
| 120 | Title: "Default", |
| 121 | Algorithm: &v1pb.Algorithm{ |
| 122 | Mask: &v1pb.Algorithm_FullMask_{FullMask: &v1pb.Algorithm_FullMask{Substitution: "******"}}, |
| 123 | }, |
| 124 | }, |
| 125 | }, |
| 126 | }, |
| 127 | }, |
| 128 | }, |
| 129 | }, |
| 130 | AllowMissing: true, |
| 131 | })) |
| 132 | a.NoError(err) |
| 133 | |
| 134 | mysqlContainer, err := getMySQLContainer(ctx) |
| 135 | defer func() { |
| 136 | mysqlContainer.Close(ctx) |
| 137 | }() |
| 138 | a.NoError(err) |
| 139 | |
| 140 | mysqlDB := mysqlContainer.db |
| 141 | _, err = mysqlDB.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %v", databaseName)) |
nothing calls this directly
no test coverage detected