Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ci/.e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ SUITES:
tags: "integrations && kafka"
- name: "Metricbeat"
tags: "metricbeat"
- name: "MS SQL Server"
tags: "integrations && mssql"
- name: "MySQL"
pullRequestFilter: " && ~old_versions"
tags: "integrations && mysql"
Expand Down
6 changes: 6 additions & 0 deletions e2e/_suites/metricbeat/features/integrations.feature
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ Examples: Kafka
| kafka | 1.1.0 |
| kafka | 0.10.2.2 |

@mssql
@xpack
Examples: MS SQL Server
| integration | version |
| mssql | 2017-GA-ubuntu |

@oracle
@skip
@xpack
Expand Down
14 changes: 14 additions & 0 deletions internal/sanitizer/sanitizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func GetConfigSanitizer(serviceType string) ConfigSanitizer {
return DockerComposeSanitizer{}
} else if strings.ToLower(serviceType) == "dropwizard" {
return DropwizardSanitizer{}
} else if strings.ToLower(serviceType) == "mssql" {
return MSSQLSanitizer{}
} else if strings.ToLower(serviceType) == "mysql" {
return MySQLSanitizer{}
}
Expand Down Expand Up @@ -56,6 +58,18 @@ func (s DropwizardSanitizer) Sanitize(content string) string {
return strings.ReplaceAll(content, "metrics_path: /metrics/metrics", "metrics_path: /test/metrics")
}

// MSSQLSanitizer represents a sanitizer for MSSQL Server
type MSSQLSanitizer struct{}

// Sanitize prepends test application context
func (s MSSQLSanitizer) Sanitize(content string) string {
log.Debug("Sanitising mssql")
replacedContent := strings.ReplaceAll(content, `domain\username`, "sa")
replacedContent = strings.ReplaceAll(replacedContent, "verysecurepassword", "1234_asdf")
Comment on lines +67 to +68
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply default credentials in metricbeat's configuration


return replacedContent
}

// MySQLSanitizer represents a sanitizer for Dropwizard
type MySQLSanitizer struct{}

Expand Down
5 changes: 5 additions & 0 deletions internal/sanitizer/sanitizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func TestGetConfigSanitizer(t *testing.T) {
content: ": /metrics",
expectedContent: ": /metrics",
},
{
service: "mssql",
content: `username: domain\username\n password: verysecurepassword`,
expectedContent: `username: sa\n password: 1234_asdf`,
},
{
service: "mysql",
content: `hosts: ["root:secret@tcp(mysql:3306)/"]`,
Expand Down