Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit f701ab5

Browse files
mdelapenyamergify-bot
authored andcommitted
feat: support MSSQL Server integration in tests (#1304)
(cherry picked from commit 3188742)
1 parent dde07d5 commit f701ab5

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

.ci/.e2e-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ SUITES:
5757
tags: "integrations && kafka"
5858
- name: "Metricbeat"
5959
tags: "metricbeat"
60+
- name: "MS SQL Server"
61+
tags: "integrations && mssql"
6062
- name: "MySQL"
6163
pullRequestFilter: " && ~old_versions"
6264
tags: "integrations && mysql"

e2e/_suites/metricbeat/features/integrations.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ Examples: Kafka
6666
| kafka | 1.1.0 |
6767
| kafka | 0.10.2.2 |
6868

69+
@mssql
70+
@xpack
71+
Examples: MS SQL Server
72+
| integration | version |
73+
| mssql | 2017-GA-ubuntu |
74+
6975
@oracle
7076
@skip
7177
@xpack

internal/sanitizer/sanitizer.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ func GetConfigSanitizer(serviceType string) ConfigSanitizer {
2222
return DockerComposeSanitizer{}
2323
} else if strings.ToLower(serviceType) == "dropwizard" {
2424
return DropwizardSanitizer{}
25+
} else if strings.ToLower(serviceType) == "mssql" {
26+
return MSSQLSanitizer{}
2527
} else if strings.ToLower(serviceType) == "mysql" {
2628
return MySQLSanitizer{}
2729
}
@@ -56,6 +58,18 @@ func (s DropwizardSanitizer) Sanitize(content string) string {
5658
return strings.ReplaceAll(content, "metrics_path: /metrics/metrics", "metrics_path: /test/metrics")
5759
}
5860

61+
// MSSQLSanitizer represents a sanitizer for MSSQL Server
62+
type MSSQLSanitizer struct{}
63+
64+
// Sanitize prepends test application context
65+
func (s MSSQLSanitizer) Sanitize(content string) string {
66+
log.Debug("Sanitising mssql")
67+
replacedContent := strings.ReplaceAll(content, `domain\username`, "sa")
68+
replacedContent = strings.ReplaceAll(replacedContent, "verysecurepassword", "1234_asdf")
69+
70+
return replacedContent
71+
}
72+
5973
// MySQLSanitizer represents a sanitizer for Dropwizard
6074
type MySQLSanitizer struct{}
6175

internal/sanitizer/sanitizer_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ func TestGetConfigSanitizer(t *testing.T) {
3131
content: ": /metrics",
3232
expectedContent: ": /metrics",
3333
},
34+
{
35+
service: "mssql",
36+
content: `username: domain\username\n password: verysecurepassword`,
37+
expectedContent: `username: sa\n password: 1234_asdf`,
38+
},
3439
{
3540
service: "mysql",
3641
content: `hosts: ["root:secret@tcp(mysql:3306)/"]`,

0 commit comments

Comments
 (0)