Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][receiver/sqlserver] Fix newlines when testing on Windows #32525

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Fix lint
  • Loading branch information
crobert-1 committed Apr 18, 2024
commit a18d9bb470456e3862591e6aa5201500fdbad2e6
8 changes: 4 additions & 4 deletions receiver/sqlserverreceiver/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ import (
)

func TestQueryIODBWithoutInstanceName(t *testing.T) {
expected_bytes, err := os.ReadFile(path.Join("./testdata", "databaseIOQueryWithoutInstanceName.txt"))
expectedBytes, err := os.ReadFile(path.Join("./testdata", "databaseIOQueryWithoutInstanceName.txt"))
require.NoError(t, err)
// Replace all will fix newlines when testing on Windows
expected := strings.ReplaceAll(string(expected_bytes[:]), "\r\n", "\n")
expected := strings.ReplaceAll(string(expectedBytes), "\r\n", "\n")

actual := getSQLServerDatabaseIOQuery("")

require.Equal(t, expected, actual)
}

func TestQueryIODBWithInstanceName(t *testing.T) {
expected_bytes, err := os.ReadFile(path.Join("./testdata", "databaseIOQueryWithInstanceName.txt"))
expectedBytes, err := os.ReadFile(path.Join("./testdata", "databaseIOQueryWithInstanceName.txt"))
require.NoError(t, err)
// Replace all will fix newlines when testing on Windows
expected := strings.ReplaceAll(string(expected_bytes[:]), "\r\n", "\n")
expected := strings.ReplaceAll(string(expectedBytes), "\r\n", "\n")

actual := getSQLServerDatabaseIOQuery("instanceName")

Expand Down